1 | <?php |
||
9 | trait Searchable |
||
10 | { |
||
11 | use HandlesRequestAndResponse; |
||
12 | |||
13 | private $moduleSearchPage = 'SearchPage'; |
||
14 | |||
15 | /** |
||
16 | * @return string |
||
17 | */ |
||
18 | protected function getSearchScope() |
||
22 | |||
23 | /** |
||
24 | * Executes search to API. Query - search string. |
||
25 | * |
||
26 | * @param string $query |
||
27 | * @param string $scope |
||
28 | * @param array $bookmarks |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | public function searchCall($query, $scope, $bookmarks = []) |
||
51 | |||
52 | /** |
||
53 | * Creates Pinterest API search request. |
||
54 | * |
||
55 | * @param string $query |
||
56 | * @param string $scope |
||
57 | * @param array $bookmarks |
||
58 | * |
||
59 | * @return array |
||
60 | */ |
||
61 | protected function createSearchQuery($query, $scope, $bookmarks = []) |
||
68 | |||
69 | /** |
||
70 | * Search entities by search query. |
||
71 | * |
||
72 | * @param string $query |
||
73 | * @param int $limit |
||
74 | * |
||
75 | * @return \Iterator |
||
76 | */ |
||
77 | public function search($query, $limit = 0) |
||
86 | |||
87 | /** |
||
88 | * @param array $bookmarks |
||
89 | * @param array $options |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | protected function appendBookMarks($bookmarks, $options) |
||
113 | |||
114 | /** |
||
115 | * Parses simple Pinterest search API response |
||
116 | * on request with bookmarks. |
||
117 | * |
||
118 | * @param array $response |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | protected function parseSearchResult($response) |
||
136 | } |
||
137 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: