1 | <?php |
||
16 | class Search implements SearchInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var RestClient |
||
20 | */ |
||
21 | private $client; |
||
22 | |||
23 | /** |
||
24 | * @param RestClient $client The http client |
||
25 | */ |
||
26 | public function __construct(RestClient $client) |
||
30 | |||
31 | /** |
||
32 | * Returns the identifiers of the search engine's extension |
||
33 | * |
||
34 | * @param string $searchEngine The search engine |
||
35 | * @param integer $ttl The time to live for the cache |
||
36 | * |
||
37 | * @return array [['id' => 1, 'name => '.fr'] [...]] |
||
38 | */ |
||
39 | public function getSearchEngineExtensions($searchEngine, $ttl = null) |
||
50 | |||
51 | /** |
||
52 | * Get the town's code |
||
53 | * |
||
54 | * @param string $name The town name |
||
55 | * @param string $country The country ISO |
||
56 | * |
||
57 | * @return array [['id' => 1, 'city_code => '1234', 'city_name' => 'dunkerque', 'code_dep' : '59']] |
||
58 | */ |
||
59 | public function getTownCode($name, $country = 'FR') |
||
69 | |||
70 | /** |
||
71 | * Retrieves the url position given a keyword |
||
72 | * |
||
73 | * @param string $keyword |
||
74 | * @param string $url |
||
75 | * @param string $searchEngine |
||
76 | * @param string $callback |
||
77 | * @param integer $geolocId |
||
78 | * @param integer $location |
||
79 | * @param integer $maxPage |
||
80 | * |
||
81 | * @return array |
||
82 | * |
||
83 | * { |
||
84 | * "url_positioned": "", |
||
85 | * "position": "+100", |
||
86 | * "page": "-", |
||
87 | * "type": "seo_natural", |
||
88 | * "serp": "", |
||
89 | * "nbr_results": 250000000, |
||
90 | * "top": "https://urltestdefault.com/path/to/image", |
||
91 | * "keyword": "keyword", |
||
92 | * "url_search": "lemonde.fr", |
||
93 | * "searchEngine": "google", |
||
94 | * "location": "13" |
||
95 | * } |
||
96 | */ |
||
97 | public function getUrlRankByKeyword($keyword, $url, $searchEngine = 'google', $callback = null, $geolocId = null, $location = 13, $maxPage = null) |
||
123 | |||
124 | public function getNaturalSeoResult() |
||
128 | |||
129 | public function getSemResult() |
||
133 | } |
||
134 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: