1 | <?php |
||
16 | class GetFrom |
||
17 | { |
||
18 | /** |
||
19 | * @var Client |
||
20 | */ |
||
21 | protected $client; |
||
22 | |||
23 | /** |
||
24 | * GetFrom constructor. |
||
25 | * @param Client|null $client |
||
26 | */ |
||
27 | 12 | public function __construct(Client $client = null) |
|
31 | |||
32 | /** |
||
33 | * Return the http client |
||
34 | * (useful to mock the response for unit testing) |
||
35 | * |
||
36 | * @return Client |
||
37 | */ |
||
38 | 2 | public function getHttpClient() |
|
42 | |||
43 | /** |
||
44 | * retrieve the search result data from the given url |
||
45 | * |
||
46 | * @param $url |
||
47 | * @param bool $detailedAd |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | 4 | public function search($url, $detailedAd = false) |
|
76 | |||
77 | /** |
||
78 | * Retrieve the ad's data from an ad's ID and its category |
||
79 | * |
||
80 | * @param $id |
||
81 | * @param $category |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | 2 | private function adById($id, $category) |
|
89 | |||
90 | /** |
||
91 | * Retrieve the ad's data from the given url |
||
92 | * |
||
93 | * @param $url |
||
94 | * @return array |
||
95 | */ |
||
96 | 4 | private function adByUrl($url) |
|
104 | |||
105 | /** |
||
106 | * Dynamique method to retrive the data by url OR id and category |
||
107 | * |
||
108 | * @return bool|mixed |
||
109 | */ |
||
110 | 6 | public function ad() |
|
122 | } |
||
123 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: