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 | /** |
||
27 | * @param IpstackClientInterface $ipstack_client |
||
28 | * @param CacheItemPoolInterface $cache PSR-6 Cache ItemPool |
||
29 | */ |
||
30 | 24 | public function __construct( IpstackClientInterface $ipstack_client, CacheItemPoolInterface $cache, LoggerInterface $logger = null ) |
|
36 | |||
37 | |||
38 | /** |
||
39 | * @param int|null $lifetime Cache Lifetime in seconds (or NULL) |
||
40 | * @return self |
||
41 | */ |
||
42 | 8 | public function setCacheLifeTime( $lifetime ) |
|
47 | |||
48 | /** |
||
49 | * @return int|null |
||
50 | */ |
||
51 | 24 | public function getCacheLifeTime() |
|
55 | |||
56 | |||
57 | 16 | public function get( string $client_ip, array $custom_query = array() ) : array |
|
88 | |||
89 | } |
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: