1 | <?php |
||
10 | class IpstackClientPsr6CacheDecorator implements IpstackClientInterface |
||
11 | { |
||
12 | use LoggerAwareTrait; |
||
13 | |||
14 | |||
15 | /** |
||
16 | * @var CacheItemPoolInterface |
||
17 | */ |
||
18 | public $cache; |
||
19 | |||
20 | /** |
||
21 | * @var int|null |
||
22 | */ |
||
23 | public $cache_lifetime; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | public $loglevel_name; |
||
29 | |||
30 | |||
31 | /** |
||
32 | * @param IpstackClientInterface $ipstack_client |
||
33 | * @param CacheItemPoolInterface $cache PSR-6 Cache ItemPool |
||
34 | */ |
||
35 | 24 | public function __construct( IpstackClientInterface $ipstack_client, CacheItemPoolInterface $cache, LoggerInterface $logger = null, string $loglevel_name = "info" ) |
|
42 | |||
43 | |||
44 | /** |
||
45 | * @param int|null $lifetime Cache Lifetime in seconds (or NULL) |
||
46 | * @return self |
||
47 | */ |
||
48 | 8 | public function setCacheLifeTime( $lifetime ) |
|
53 | |||
54 | /** |
||
55 | * @return int|null |
||
56 | */ |
||
57 | 24 | public function getCacheLifeTime() |
|
61 | |||
62 | |||
63 | 16 | public function get( string $client_ip, array $custom_query = array() ) : array |
|
94 | |||
95 | } |
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: