1 | <?php |
||
8 | class YahooController extends Controller |
||
9 | { |
||
10 | const YAHOO_API = 'https://query.yahooapis.com/v1/public/yql'; |
||
11 | /** |
||
12 | * Instance of Guzzle Client |
||
13 | * @var object |
||
14 | */ |
||
15 | protected $client; |
||
16 | |||
17 | /** |
||
18 | * BaseUrl |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $baseUrl; |
||
22 | |||
23 | /** |
||
24 | * Initialize the Controller with necessary arguments |
||
25 | */ |
||
26 | public function __construct() |
||
36 | |||
37 | /** |
||
38 | * Get the response from Yahoo API |
||
39 | * @param string $relativeUrl |
||
40 | */ |
||
41 | private function setGetResponse($relativeUrl) |
||
45 | |||
46 | /** |
||
47 | * Get the whole response from a get operation |
||
48 | * @return array |
||
49 | */ |
||
50 | private function getResponse() |
||
54 | |||
55 | /** |
||
56 | * Get the data response from a get operation |
||
57 | * @return array |
||
58 | */ |
||
59 | private function getData() |
||
63 | |||
64 | |||
65 | /** |
||
66 | * Return all data to the Yahoo API dashboard |
||
67 | * @return mixed |
||
68 | */ |
||
69 | public function getPage() |
||
75 | |||
76 | } |
||
77 |
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: