Finds billing agreements that are due

@param $context
@param $limit
@param int $page
@return array
766143
public function findBillingAgreements(PricingContextInterface $context, $limit = null, $page = 1)
    {
        $offset = ($page - 1) * $limit;
        if (isset($context['endDate'])) {
            $endDate = new \DateTime($context['endDate']);
        } else {
            $endDate = new \DateTime();
        }
        $params = array(1 => $endDate);

        /** @var \Molino\Doctrine\ORM\SelectQuery $query  */
        $query = $this->gateway->createQuery('select', $this->billingAgreementClass);

        $qb = $query->getQueryBuilder();
        $qb->join('m.paymentProfile', 'pp');

        $qb->andWhere('m.generateRequestOn <= ?1');

        if (isset($context['partner'])) {
            $qb->andWhere('m.partner = ?3');
            $params[3] = $context['partner'];
        }

        $qb->andWhere('m.active = ?4');
        $params[4] = 1;

        if ($limit) {
            $qb
                ->setMaxResults($limit)
                ->setFirstResult($offset)
            ;
        }

        return $qb
            ->setParameters($params)
            ->getQuery()
            ->getResult()
        ;
    }
1049737
public function getList($page = 1)
    {
        $this->checkPageNumber($page);

        return $this->adapter->get(sprintf('/companies?page=%d', $page));
    }
225215
public function paginate($page, $limit)
    {
        if (!$this->getModelClass()) {
            throw new ModelNotFoundException('setModelClass');
        }

        /** @var EntityRepository $repository */
        $repository = $this->getManager()->getRepository($this->getModelClass());
        $queryBuilder = $repository->createQueryBuilder(Constants::MODEL_ALIAS);

        $filterList = new FilterQueryEvent();
        $filterList->setQueryBuilder($queryBuilder);
        $filterList->setAlias(Constants::MODEL_ALIAS);
        $filterList->setModelClass($this->getModelClass());

        $this->getEventSubscriber()->subscribe(Constants::FILTER_LIST, $filterList);

        $query = $filterList->getQueryBuilder()->getQuery();
        $query->useQueryCache(true);
        $query->useResultCache(true, $this->cacheLifetime, sprintf('%s_%s', $this->getModelClass(), serialize($query->getParameters()->toArray())));

        return $this->getPaginator()->paginate($query, $page, $limit);
    }
275237
public function getAllGroups($page, $max = 50)
    {
        $query = $this->groupRepo->findAll(false);
        return $this->pagerFactory->createPager($query, $page, $max);
    }
976499
public function getByPage($page = 1, $limit = 10, $with = array())
    {
        $result = new StdClass;
        $result->page = $page;
        $result->limit = $limit;
        $result->totalItems = 0;
        $result->items = array();

        $query = $this->make($with);
        $users = $query->skip($limit * ($page - 1))
            ->take($limit)
            ->get();
        $result->totalItems = $this->model->count();
        $result->items = $users->all();

        return $result;
    }
108815
public function createPager($page, $limit = null)
    {
        $limit = $limit !== null ? $limit : $this->defaultLimit;

        return new Pager($page, $limit);
    }
992588
public function getSimple(int $page, int $limit = 10, bool $isClount = false): \Illuminate\Contracts\Pagination\Paginator
    {
        if (!$this->_columns && !$this->_query) {
            return null;
        }
        if ($isClount) {
            $countTotal = $this->_query->count();
        }
        $this->_query->skip(($page - 1) * $page)->take($page + 1);
        $this->_data = $this->_query->simplePaginate($limit);
        if ($isClount) {
            $this->_data->totalCount = $countTotal;
        }
        foreach ($this->_data->items() as $key => $instance) {
            if ($instance instanceof \Illuminate\Database\Eloquent\Model) {
                $_listRow = [];
                foreach ($this->_columns->getColumns() as $column) {
                    $_listRow[$column->getKey()] = $column->getValues($instance);
                    if ($column->getKey() === 'preview') {
                    }
                }
                $buttons = $this->_columns->filterActions($instance);
                if (count($buttons)) {
                    $_listRow = array_merge($_listRow, [Column::ACTION_NAME => implode('', $buttons)]);
                }
                $this->_data->offsetSet($key, $_listRow);
            }
        }

        return $this->_data;
    }
308169
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllCashOnDeliveryPayments(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllCashOnDeliveryPayments();
        }
    }
860059
public function getPagePartRefs(HasPagePartsInterface $page, $context = 'main')
    {
        return $this->findBy(array(
            'pageId' => $page->getId(),
            'pageEntityname' => ClassLookup::getClass($page),
            'context' => $context,
        ), array('sequencenumber' => 'ASC'));
    }
111312
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllCreditCardPayments(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllCreditCardPayments();
        }
    }
292450
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllTaxRates(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllTaxRates();
        }
    }
350300
public function findAll($page = 1, $max = 50)
    {
        $offset = (($page - 1) * $max);
        $productOrderItems = $this->productOrderItemRepository->findBy(array(), array(), $max, $offset);
        return $productOrderItems;
    }
939443
public function withPaging($page = null, $limit = null)
    {
        $getPage = $this->input->get('page');
        $getLimit = $this->input->get('limit');

        $page = empty($page) ? (empty($getPage) ? 1 : $getPage) : $page;
        $limit = empty($limit) ? (empty($getLimit) ? 10 : $getLimit) : $limit;

        $this->qb->page($page, $limit);

        return $this;
    }
1364384
public function execute(int $page, int $limit): void
    {
        $page = $page <= 1 ? 1 : $page;
        $rows = $this->getRows($page, $limit);

        $headers = [];
        $mode = 'a';
        if (1 === $page) {
            $headers = $this->getHeaders();
            $mode = 'w';
        }

        // Prepend columns to result
        if (!empty($headers)) {
            array_unshift($rows, $headers);
        }

        $this->create($rows, $mode);
    }
817899
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllFreeShippingCoupons(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllFreeShippingCoupons();
        }
    }
776159
public function getAll($identity, $page = 1, $perPage = 25)
    {
        $params = array(
            'page' => $page,
            'per_page' => $perPage
        );

        return $this->_user->get('account/identity/' . $identity . '/token', $params);
    }
467311
protected function getTransactions($page = null)
    {
        //check if has a page, if doesn't have one then start at the first.
        if (is_null($page)) $page = 1;

        try {

            //check if is the first step, if is just add the response object to local var
            if (is_null($this->_PagSeguroPaymentList)) {
                $this->_PagSeguroPaymentList = $this->requestPagSeguroPayments($page);
            } else {
                $response = $this->requestPagSeguroPayments($page);
                //update some important data
                $this->_PagSeguroPaymentList->setDate($response->getDate());
                $this->_PagSeguroPaymentList->setCurrentPage($response->getCurrentPage());
                $this->_PagSeguroPaymentList->setResultsInThisPage(
                    $response->getResultsInThisPage() + $this->_PagSeguroPaymentList->getResultsInThisPage()
                );
                //add new transactions
                $this->_PagSeguroPaymentList->addTransactions($response->getTransactions());
            }

            //check if was more pages
            if ($this->_PagSeguroPaymentList->getTotalPages() > $page) {
                $this->getPagSeguroPayments(++$page);
            }
        } catch (\Exception $exception) {
            throw $exception;
        }
        return $this->_PagSeguroPaymentList;
    }