zendesk/zendesk_api_client_php

View on GitHub
src/Zendesk/API/Traits/Utility/Pagination/SinglePageStrategy.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Zendesk\API\Traits\Utility\Pagination;


/**
 * Single Page (no pagination)
 * Used in paginationStrategyClass
 */
class SinglePageStrategy extends AbstractStrategy
{
    protected $started = false;

    public function page($getPageFn)
    {
        $this->started = true;
        $response = $getPageFn();

        return $response->{$this->resourcesKey};
    }

    public function shouldGetPage($current_page) {
        return !$this->started;
    }
}