GetDictionaries.php 692 Bytes
<?php

namespace App\Service\Requests\Direct;

use App\Jobs\ProcessCallLimitedAPI;
use App\Service\Requests\DirectRequest;

class GetDictionaries extends DirectRequest
{
    protected $next;

    function call($next = null, $response = null)
    {
        $this->next = $next;
        $this->requestPrepare($response);
        $process = new ProcessCallLimitedAPI($this);
        dispatch($process)->onQueue('limits');
    }

    function handle($response)
    {
        if ($this->next) {
            $this->next->call(null, $response);
        }
    }

    private function requestPrepare($response)
    {
        $this->setService('dictionaries');
        $this->setMethod('get');
    }
}