models/Instagram.php
protected static function _resolvePaginated(array $pagination, array $data) {
		$client = new Client();

		// `pagination` key is an empty array if there are no more pages.
		if (!$pagination) {
			Logger::debug("Instagram-API finished resolving pagination.");
			return $data;
		}
		Logger::debug("Instagram-API retrieving next page `{$pagination['next_url']}`.");

		$response = $client->request('GET', $pagination['next_url']);
		$result = json_decode($response->getBody(), true);

		return static::_resolvePaginated(
			$result['pagination'], array_merge($data, $result['data'])
		);
	}
protected static function _resolvePaginated(array $pagination, array $data) {
		$client = new Client();

		// `pagination` key is an empty array if there are no more pages.
		if (!$pagination) {
			Logger::debug("Instagram-API finished resolving pagination.");
			return $data;
		}
		Logger::debug("Instagram-API retrieving next page `{$pagination['next_url']}`.");

		$response = $client->request('GET', $pagination['next_url']);
		$result = json_decode($response->getBody(), true);

		return static::_resolvePaginated(
			$result['pagination'], array_merge($data, $result['data'])
		);
	}
protected static function _resolvePaginated ( array $ pagination , array $ data ) { $ client = new Client ( ) ; // `pagination` key is an empty array if there are no more pages. if ( ! $ pagination ) { Logger :: debug ( "Instagram-API finished resolving pagination." ) ; return $ data ; } Logger :: debug ( "Instagram-API retrieving next page `{$pagination['next_url']}`." ) ; $ response = $ client -> request ( 'GET' , $ pagination [ 'next_url' ] ) ; $ result = json_decode ( $ response -> getBody ( ) , true ) ; return static :: _resolvePaginated ( $ result [ 'pagination' ] , array_merge ( $ data , $ result [ 'data' ] ) ) ; }
Will never cache first page, but cache all subsequent pages.
Will never cache first page but cache all subsequent pages .