1 | <?php |
||
9 | class CacheableDecorator |
||
10 | { |
||
11 | /** |
||
12 | * Cacheable Repository. |
||
13 | * |
||
14 | * @var \Suitmedia\Cacheable\Contracts\CacheableRepository |
||
15 | */ |
||
16 | private $repository; |
||
17 | |||
18 | /** |
||
19 | * Cacheable service object. |
||
20 | * |
||
21 | * @var \Suitmedia\Cacheable\CacheableService |
||
22 | */ |
||
23 | private $service; |
||
24 | |||
25 | /** |
||
26 | * Class constructor. |
||
27 | * |
||
28 | * @param \Suitmedia\Cacheable\CacheableService $service |
||
29 | * @param \Suitmedia\Cacheable\Contracts\CacheableRepository $repository |
||
30 | */ |
||
31 | public function __construct(CacheableService $service, CacheableRepository $repository) |
||
36 | |||
37 | /** |
||
38 | * Generate custom cache tags. |
||
39 | * |
||
40 | * @param array $tags |
||
41 | * @param Model $object |
||
42 | * |
||
43 | * @return array |
||
|
|||
44 | */ |
||
45 | private function generateCustomTags($tags, Model $object) |
||
57 | |||
58 | /** |
||
59 | * Generate cache tags. |
||
60 | * |
||
61 | * @param mixed $args |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | private function generateTags($args) |
||
80 | |||
81 | /** |
||
82 | * Finds whether the metod is cacheable. |
||
83 | * |
||
84 | * @param string $method |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | private function methodIsCacheable($method) |
||
92 | |||
93 | /** |
||
94 | * Dynamically call methods from repository. |
||
95 | * |
||
96 | * @param string $method |
||
97 | * @param mixed $args |
||
98 | * |
||
99 | * @return mixed |
||
100 | */ |
||
101 | public function __call($method, $args) |
||
125 | } |
||
126 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.