DirectHandler.php 554 Bytes
<?php
namespace App\Service\Handlers;

class DirectHandler extends AdsHandler
{
    public function limited()
    {
        return $this->response['result']['LimitedBy'] ?? false;
    }

    protected function parse($response)
    {
        $this->response = $response->json();
    }

    public function checkError($response, $service, $method)
    {
        $this->parse($response);
        if ($this->response['error'] ?? false) {
            throw new \Exception("[$service][{$method}] {$this->response['error']['error_detail']}");
        }
    }
}