1 | <?php |
||
21 | class Tinycc implements Provider |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | const ENDPOINT = 'http://tiny.cc'; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private $params = [ |
||
32 | 'c' => 'rest_api', |
||
33 | 'version' => '2.0.3', |
||
34 | 'format' => 'json', |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * @param string $login |
||
39 | * @param string $apiKey |
||
40 | * @param HttpClient $httpClient |
||
41 | * @param RequestFactory $requestFactory |
||
42 | */ |
||
43 | 4 | public function __construct($login, $apiKey, HttpClient $httpClient, RequestFactory $requestFactory) |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 1 | public function shorten($url) |
|
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | 1 | public function expand($url) |
|
93 | } |
||
94 |
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: