@param string          $uri
@param CustomerRequest $customerRequest

@return Customer[]|PagedCollection
975725
private function loadCustomers(
        string $uri,
        CustomerRequest $customerRequest
    ): PagedCollection {
        /** @var HalPagedResources $customerResources */
        $customerResources = $this->restClient->getResources(
            Customer::class,
            'customers',
            $uri
        );
        $customers = $customerResources->map(
            function (HalResource $customerResource) use ($customerRequest) {
                return $this->hydrateCustomerWithSubEntities($customerResource, $customerRequest);
            }
        );

        return new PagedCollection(
            $customers,
            $customerResources->getPageMetadata(),
            $customerResources->getLinks(),
            function (string $uri) use ($customerRequest) {
                return $this->loadCustomers($uri, $customerRequest);
            }
        );
    }
1342932
public function uri($uri = null)
    {
        $page = $this->findPageByUri($uri);

        abort_if(!$page, '404');

        if ($page->private && !Auth::check()) {
            return redirect()->guest(route(app()->getLocale().'::login'));
        }

        if ($page->redirect && $page->subpages->count() > 0) {
            $childUri = $page->subpages->first()->uri();

            return redirect($childUri);
        }

        // get submenu
        $children = $this->repository->getSubMenu($page->uri);

        $templateDir = 'pages::'.config('typicms.template_dir', 'public').'.';
        $template = $page->template ?: 'default';

        if (!view()->exists($templateDir.$template)) {
            info('Template '.$template.' not found, switching to default template.');
            $template = 'default';
        }

        return response()->view($templateDir.$template, compact('children', 'page'));
    }
809773
@RequestMapping(path = "/{customerId}", method=RequestMethod.GET)
    public ResponseEntity<Customer> getCustomer(@PathVariable("customerId") Long customerId, @RequestParam(required=true) String name){
        Customer customer = customerService.getCustomer(customerId);
        if(customer != null){
            return new ResponseEntity<Customer>(customer, HttpStatus.OK);
        }
        return new ResponseEntity<Customer>(HttpStatus.NOT_FOUND);
    }
104941
private function loadThreads(string $uri): PagedCollection
    {
        $factory = new ThreadFactory();

        /** @var HalPagedResources $threadResources */
        $threadResources = $this->restClient->getResources(function (array $data) use ($factory) {
            return $factory->make($data['type'], $data);
        }, 'threads', $uri);
        $threads = $threadResources->map(function (HalResource $threadResource) {
            return $threadResource->getEntity();
        });

        return new PagedCollection(
            $threads,
            $threadResources->getPageMetadata(),
            $threadResources->getLinks(),
            function (string $uri) {
                return $this->loadThreads($uri);
            }
        );
    }
887238
protected function httpGet($uri)
    {
        $results = [];
        // Start requesting at page 1
        $page = 1;
        // We dont know how many pages there are, so assume 1 until we know
        $pagecount = 1;
        while ($page <= $pagecount) {
            $this->log[] = [
                        'request' => [
                                    'method' => 'GET',
                                    'uri'    => $uri.'?page='.$page,
                                    ],
                        ];
            $response = \Httpful\Request::get($uri.'?page='.$page)
                                                    ->addHeader('X-Auth-Email', $this->email)
                                                    ->addHeader('X-Auth-Key', $this->apikey)
                                                    ->expectsType(\Httpful\Mime::JSON)
                                                    ->parseWith(function ($body) {
                                                        return \Metaclassing\Utility::decodeJson($body);
                                                    })
                                                    ->send()
                                                    ->body;
            $this->log[count($this->log) - 1]['response'] = $response;
            if ($response['success'] != true) {
                throw new \Exception("get {$uri} unsuccessful".\Metaclassing\Utility::encodeJson($response));
            }
            foreach ($response['result'] as $result) {
                array_push($results, $result);
            }
            // Now that we KNOW the pagecount, update that and increment our page counter
            $pagecount = $response['result_info']['total_pages'];
            // And get the next page ready for the next request
            $page++;
        }

        return $results;
    }
1306500
public function get(
        $page = 1,
        $pageSize = 1000,
        $subscribed = null,
        $onlyGuest = false,
        $websiteId = null,
        $storeId = null
    ) {

        $this
            ->initCollection()
            ->joinWebsite()
            ->filterWebsite($websiteId)
            ->filterStore($storeId)
            ->filterSubscribed($subscribed)
            ->filterCustomers($onlyGuest)
            ->setPage($page, $pageSize);

        return $this->subscriptionsResponseFactory->create()
            ->setCurrentPage($this->subscriptionCollection->getCurPage())
            ->setLastPage($this->subscriptionCollection->getLastPageNumber())
            ->setPageSize($this->subscriptionCollection->getPageSize())
            ->setTotalCount($this->subscriptionCollection->getSize())
            ->setSubscriptions($this->handleSubscriptions());
    }
1009026
public static function make($uri, array $queryParameters = [])
    {
        $uri = ($uri instanceof UriInterface) ? $uri : new Uri($uri);
        if ($queryParameters) {
            $uri = static::addQueryParameters($uri, $queryParameters);
        }
        return $uri;
    }
716060
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllStoreCredits(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllStoreCredits();
        }
    }
568213
public function beforeDeleteById(
        \Magento\Customer\Api\CustomerRepositoryInterface $subject,
        $customerId
    ) {
        $this->deleteSnaps($customerId);
        $this->deleteChange($customerId);
        $result = [$customerId];
        return $result;
    }
1067340
public static function parseIri(string $iri, string $pageParameterName): array
    {
        $parts = parse_url($iri);
        if (false === $parts) {
            throw new InvalidArgumentException(sprintf('The request URI "%s" is malformed.', $iri));
        }

        $parameters = [];
        if (isset($parts['query'])) {
            $parameters = RequestParser::parseRequestParams($parts['query']);

            // Remove existing page parameter
            unset($parameters[$pageParameterName]);
        }

        return ['parts' => $parts, 'parameters' => $parameters];
    }
640835
public function updateCustomer(int $customerId, $customer) : array
    {
        Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');

        return (array)$this->master->doRequest(
            'PUT',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId),
            $customer
        );
    }
958296
protected function getValidClientAndRedirectUri(string $clientId = null, string $redirectFromQuery = null): array
    {
        $client           = null;
        $validRedirectUri = null;

        if ($clientId !== null &&
            ($client = $this->readClientByIdentifier($clientId)) !== null
        ) {
            $validRedirectUri = $this->selectValidRedirectUri($client, $redirectFromQuery);
            if ($validRedirectUri === null) {
                $this->logDebug(
                    'Choosing valid redirect URI for client failed.',
                    ['client_id' => $clientId, 'redirect_uri_from_query' => $redirectFromQuery]
                );
            }
        } else {
            $this->logDebug('Client is not found.', ['client_id' => $clientId]);
        }

        return [$client, $validRedirectUri];
    }
612113
public function createPaymentByFileReferenceAndCustomerIdQuery($fileReference, $customerId)
    {
        $query = $this->getFactory()->createPaymentPayoneQuery();
        $query->useSpySalesOrderQuery()
            ->filterByFkCustomer($customerId)
            ->endUse()
            ->useSpyPaymentPayoneDetailQuery()
            ->filterByMandateIdentification($fileReference)
            ->endUse()
            ->useSpyPaymentPayoneApiLogQuery()
            ->filterByStatus(PayoneApiConstants::RESPONSE_TYPE_APPROVED)
            ->endUse();

        return $query;
    }
54345
protected function loadPage(
        string $entityClass,
        string $rel,
        string $uri
    ): PagedCollection {
        /** @var HalPagedResources $pagedResources */
        $pagedResources = $this->restClient->getResources(
                $entityClass,
                $rel,
                $uri
            );

        $mapClosure = function (HalResource $resource) {
            return $resource->getEntity();
        };
        $nextPage = function (string $uri) use ($entityClass, $rel) {
            return $this->loadPage($entityClass, $rel, $uri);
        };

        return new PagedCollection(
            $pagedResources->map($mapClosure),
            $pagedResources->getPageMetadata(),
            $pagedResources->getLinks(),
            $nextPage
        );
    }
979965
public function get(int $id, CustomerRequest $customerRequest = null): Customer
    {
        $customerResource = $this->restClient->getResource(
            Customer::class,
            sprintf('/v2/customers/%d', $id)
        );

        return $this->hydrateCustomerWithSubEntities(
            $customerResource,
            $customerRequest ?: new CustomerRequest()
        );
    }
368241
public static function extract_query_from_uri($uri)
	{
		$uri_query_str = parse_url($uri, PHP_URL_QUERY);

		if ( ! $uri_query_str)
		{
			return array();
		}

		parse_str($uri_query_str, $uri_query);

		return $uri_query;
	}
249586
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllProducts(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllProducts();
        }
    }