DirectRequest.php 548 Bytes
<?php
namespace App\Service\Requests;

use App\Models\Tokens;

class DirectRequest extends APIRequest {

    function chunk($count): ?\App\Service\Contract\APIRequest
    {
        if ($this->params['Page']['Limit'] <= $count) {
            return null;
        }

        $nextCount = $this->params['Page']['Limit'] - $count;
        $this->params['Page']['Limit'] = $count;

        $new = clone $this;
        $params = $this->params;
        $params['Page']['Limit'] = $nextCount;
        $new->setParams($params);
        return $new;
    }
}