1 | <?php |
||
8 | trait SearchTrait |
||
9 | { |
||
10 | use ProviderTrait, PaginationTrait; |
||
11 | private $moduleSearchPage = "SearchPage"; |
||
12 | |||
13 | /** |
||
14 | * @return string |
||
15 | */ |
||
16 | abstract protected function getScope(); |
||
17 | |||
18 | /** |
||
19 | * Executes search to API. Query - search string. |
||
20 | * |
||
21 | * @param string $query |
||
22 | * @param string $scope |
||
23 | * @param array $bookmarks |
||
24 | * @return array |
||
25 | */ |
||
26 | public function searchCall($query, $scope, $bookmarks = []) |
||
35 | |||
36 | /** |
||
37 | * Executes search to API with pagination. |
||
38 | * |
||
39 | * @param string $query |
||
40 | * @param int $batchesLimit |
||
41 | * @return \Iterator |
||
42 | */ |
||
43 | public function searchWithPagination($query, $batchesLimit) |
||
52 | |||
53 | /** |
||
54 | * Creates Pinterest API search request |
||
55 | * |
||
56 | * @param $query |
||
57 | * @param $scope |
||
58 | * @param array $bookmarks |
||
59 | * @return array |
||
60 | */ |
||
61 | public function createSearchRequest($query, $scope, $bookmarks = []) |
||
70 | |||
71 | /** |
||
72 | * Search entities by search query |
||
73 | * |
||
74 | * @param string $query |
||
75 | * @param int $batchesLimit |
||
76 | * @return \Iterator |
||
77 | */ |
||
78 | public function search($query, $batchesLimit = 0) |
||
82 | |||
83 | /** |
||
84 | * @param $bookmarks |
||
85 | * @param $options |
||
86 | * @return array |
||
87 | */ |
||
88 | protected function appendBookMarks($bookmarks, $options) |
||
108 | } |