1 | <?php |
||
7 | class Response implements ResponseInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $response; |
||
13 | |||
14 | /** |
||
15 | * @var array|null |
||
16 | */ |
||
17 | protected $lastError; |
||
18 | |||
19 | /** |
||
20 | * Check if specified data exists in response |
||
21 | * @param $response |
||
22 | * @param null $key |
||
23 | * @return array|bool |
||
24 | */ |
||
25 | public function getData($response, $key = null) |
||
44 | |||
45 | /** |
||
46 | * Checks if response is not empty |
||
47 | * |
||
48 | * @param array $response |
||
49 | * @return bool |
||
50 | */ |
||
51 | public function notEmpty($response) |
||
55 | |||
56 | public function checkResponse($response) |
||
60 | |||
61 | /** |
||
62 | * Check for error info in api response and save |
||
63 | * it. |
||
64 | * |
||
65 | * @param array $response |
||
66 | * @return bool |
||
67 | */ |
||
68 | public function checkErrorInResponse($response) |
||
79 | |||
80 | /** |
||
81 | * Parse bookmarks from response |
||
82 | * @param array $response |
||
83 | * @return array|null |
||
84 | */ |
||
85 | public function getBookmarksFromResponse($response) |
||
96 | |||
97 | /** |
||
98 | * Checks Pinterest API paginated response, and parses data |
||
99 | * with bookmarks info from it. |
||
100 | * |
||
101 | * @param array $response |
||
102 | * @return array |
||
103 | */ |
||
104 | public function getPaginationData($response) |
||
117 | |||
118 | /** |
||
119 | * Parses Pinterest search API response for data and bookmarks |
||
120 | * for next pagination page |
||
121 | * |
||
122 | * @param array $response |
||
123 | * @param bool $bookmarksUsed |
||
124 | * @return array|null |
||
125 | */ |
||
126 | public function parseSearchResponse($response, $bookmarksUsed = true) |
||
134 | |||
135 | /** |
||
136 | * Parses simple Pinterest search API response |
||
137 | * on request with bookmarks |
||
138 | * |
||
139 | * @param $response |
||
140 | * @return array |
||
141 | */ |
||
142 | public function parseSimpledSearchResponse($response) |
||
155 | |||
156 | /** |
||
157 | * @return array |
||
158 | */ |
||
159 | public function getLastError() |
||
163 | } |