1 | <?php |
||
17 | abstract class Provider |
||
18 | { |
||
19 | use ProviderTrait; |
||
20 | |||
21 | /** |
||
22 | * List of methods that require logged status |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $loginRequired = []; |
||
26 | |||
27 | /** |
||
28 | * Instance of the API RequestInterface |
||
29 | * |
||
30 | * @var RequestInterface |
||
31 | */ |
||
32 | protected $request; |
||
33 | |||
34 | /** |
||
35 | * Instance of the API ResponseInterface |
||
36 | * |
||
37 | * @var ResponseInterface |
||
38 | */ |
||
39 | protected $response; |
||
40 | |||
41 | /** |
||
42 | * @param RequestInterface $request |
||
43 | * @param ResponseInterface $response |
||
44 | */ |
||
45 | public function __construct(RequestInterface $request, ResponseInterface $response) |
||
50 | |||
51 | /** |
||
52 | * Executes a POST request to Pinterest API |
||
53 | * |
||
54 | * @param array $requestOptions |
||
55 | * @param string $resourceUrl |
||
56 | * @param bool $returnData |
||
57 | * @return mixed |
||
58 | */ |
||
59 | public function callPostRequest($requestOptions, $resourceUrl, $returnData = null) |
||
73 | |||
74 | /** |
||
75 | * Run login check before every method if needed |
||
76 | * @param $method |
||
77 | * @param $arguments |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function __call($method, $arguments) |
||
89 | |||
90 | /** |
||
91 | * Checks if method requires login |
||
92 | * |
||
93 | * @param $method |
||
94 | */ |
||
95 | protected function checkMethodForLoginNeed($method) |
||
101 | |||
102 | |||
103 | /** |
||
104 | * @return Request |
||
105 | */ |
||
106 | protected function getRequest() |
||
110 | |||
111 | /** |
||
112 | * @return Response |
||
113 | */ |
||
114 | protected function getResponse() |
||
118 | } |