1 | <?php |
||
28 | class GearmanCacheWrapper implements CacheClearerInterface, CacheWarmerInterface |
||
29 | { |
||
30 | /** |
||
31 | * @var GearmanParser |
||
32 | * |
||
33 | * Gearman file parser |
||
34 | */ |
||
35 | private $gearmanParser; |
||
36 | |||
37 | /** |
||
38 | * @var Cache |
||
39 | * |
||
40 | * Cache instance |
||
41 | */ |
||
42 | private $cache; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | * |
||
47 | * Cache id |
||
48 | */ |
||
49 | private $cacheId; |
||
50 | |||
51 | /** |
||
52 | * @var array |
||
53 | * |
||
54 | * WorkerCollection with all workers and jobs available |
||
55 | */ |
||
56 | private $workerCollection; |
||
57 | |||
58 | /** |
||
59 | * Construct method |
||
60 | * |
||
61 | * @param GearmanParser $gearmanParser Gearman Parser |
||
62 | * @param Cache $cache Cache instance |
||
63 | * @param string $cacheId Cache id |
||
64 | */ |
||
65 | 4 | public function __construct( |
|
75 | |||
76 | /** |
||
77 | * Return gearman file parser |
||
78 | * |
||
79 | * @return GearmanParser |
||
80 | */ |
||
81 | 1 | public function getGearmanParser() |
|
85 | |||
86 | /** |
||
87 | * Return cache |
||
88 | * |
||
89 | * @return Cache Cache |
||
90 | */ |
||
91 | public function getCache() |
||
95 | |||
96 | /** |
||
97 | * Return cache id |
||
98 | * |
||
99 | * @return string Cache id |
||
100 | */ |
||
101 | public function getCacheId() |
||
105 | |||
106 | /** |
||
107 | * Return workerCollection |
||
108 | * |
||
109 | * @return array all available workers |
||
110 | */ |
||
111 | 2 | public function getWorkers() |
|
115 | |||
116 | /** |
||
117 | * loads Gearman cache, only if is not loaded yet |
||
118 | * |
||
119 | * @param Cache $cache Cache instance |
||
120 | * @param string $cacheId Cache id |
||
121 | * |
||
122 | * @return GearmanCacheWrapper self Object |
||
123 | */ |
||
124 | 4 | public function load(Cache $cache, $cacheId) |
|
150 | |||
151 | /** |
||
152 | * flush all cache |
||
153 | * |
||
154 | * @param Cache $cache Cache instance |
||
155 | * @param string $cacheId Cache id |
||
156 | * |
||
157 | * @return GearmanCacheWrapper self Object |
||
158 | */ |
||
159 | public function flush(Cache $cache, $cacheId) |
||
165 | |||
166 | /** |
||
167 | * Cache clear implementation |
||
168 | * |
||
169 | * @param string $cacheDir The cache directory |
||
170 | * |
||
171 | * @return GearmanCacheWrapper self Object |
||
172 | */ |
||
173 | public function clear($cacheDir) |
||
179 | |||
180 | /** |
||
181 | * Warms up the cache. |
||
182 | * |
||
183 | * @param string $cacheDir The cache directory |
||
184 | * |
||
185 | * @return GearmanCacheWrapper self Object |
||
186 | */ |
||
187 | public function warmUp($cacheDir) |
||
193 | |||
194 | /** |
||
195 | * Checks whether this warmer is optional or not. |
||
196 | * |
||
197 | * Optional warmers can be ignored on certain conditions. |
||
198 | * |
||
199 | * A warmer should return true if the cache can be |
||
200 | * generated incrementally and on-demand. |
||
201 | * |
||
202 | * As GearmanBundle loads cache incrementaly so is optional |
||
203 | * |
||
204 | * @return Boolean true if the warmer is optional, false otherwise |
||
205 | */ |
||
206 | 1 | public function isOptional() |
|
210 | } |
||
211 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.