1 | <?php |
||
5 | class RequestHelper |
||
6 | { |
||
7 | /** |
||
8 | * @param array|object $data |
||
9 | * @param string|null $sourceUrl |
||
10 | * @param array $bookmarks |
||
11 | * @return array |
||
12 | */ |
||
13 | public static function createRequestData($data, $sourceUrl = null, $bookmarks = []) |
||
24 | |||
25 | /** |
||
26 | * Check if specified data exists in response |
||
27 | * @param $response |
||
28 | * @param null $key |
||
29 | * @return array|bool |
||
30 | */ |
||
31 | public static function getDataFromResponse($response, $key = null) |
||
43 | |||
44 | /** |
||
45 | * Parse bookmarks from response |
||
46 | * @param array $response |
||
47 | * @return string|null |
||
48 | */ |
||
49 | protected static function _getBookmarksFromResponse($response) |
||
56 | |||
57 | /** |
||
58 | * Checks result of PIN-methods |
||
59 | * |
||
60 | * @param array $res |
||
61 | * @return bool |
||
62 | */ |
||
63 | public static function checkMethodCallResult($res) |
||
71 | |||
72 | /** |
||
73 | * Checks Pinterest API paginated response, and parses data |
||
74 | * with bookmarks info from it. |
||
75 | * |
||
76 | * @param array $res |
||
77 | * @return array |
||
78 | */ |
||
79 | public static function parsePaginatedResponse($res) |
||
92 | |||
93 | } |