APIRequest.php
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
namespace App\Service\Requests;
use App\Models\Tokens;
use App\Service\API\API;
class APIRequest implements \App\Service\Contract\APIRequest {
protected $api;
protected $service;
protected $method;
protected $params;
protected $token;
protected function __construct($api){
$this->api = $api;
}
static function getInstance($type){
switch($type){
case API::YANDEX:
return new DirectRequest($type);
}
}
function getApi(): string
{
return $this->api;
}
function setService(string $service)
{
$this->service = $service;
}
function getService()
{
return $this->service;
}
function setMethod(string $method)
{
$this->method = $method;
}
function getMethod()
{
return $this->method;
}
function setParams(array $params)
{
$this->params = $params;
}
function getParams()
{
return $this->params;
}
function setToken(Tokens $token)
{
$this->token = $token;
}
function getToken(): Tokens
{
return $this->token;
}
function chunk($count): ?\App\Service\Contract\APIRequest
{
throw new Exception('Я не знаю формата запрсов, чтобы его разбить');
}
function next($count)
{
throw new Exception('Я не знаю формата запрсов, чтобы его разбить');
}
function call($next = null, $response = null){
}
function handle($response){
}
}