These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the Ivory Http Adapter package. |
||
5 | * |
||
6 | * (c) Eric GELOEN <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please read the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Ivory\HttpAdapter\Event\Cache\Adapter; |
||
13 | |||
14 | use Stash\Pool; |
||
15 | |||
16 | /** |
||
17 | * Stash cache adapter. |
||
18 | * |
||
19 | * @author GeLo <[email protected]> |
||
20 | */ |
||
21 | class StashCacheAdapter implements CacheAdapterInterface |
||
22 | { |
||
23 | /** @var \Stash\Pool */ |
||
24 | private $pool; |
||
25 | |||
26 | /** |
||
27 | * Creates a stash cache. |
||
28 | * |
||
29 | * @param \Stash\Pool $pool The stash pool. |
||
30 | */ |
||
31 | public function __construct(Pool $pool) |
||
32 | { |
||
33 | $this->pool = $pool; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function has($id) |
||
40 | { |
||
41 | return !$this->pool->getItem($id)->isMiss(); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function get($id) |
||
48 | { |
||
49 | return $this->pool->getItem($id)->get(); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function set($id, $data, $lifeTime = 0) |
||
56 | { |
||
57 | $result = $this->pool->getItem($id)->set($data, $lifeTime); |
||
0 ignored issues
–
show
|
|||
58 | $this->pool->flush(); |
||
0 ignored issues
–
show
The method
flush() does not seem to exist on object<Stash\Pool> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
59 | |||
60 | return $result; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | public function remove($id) |
||
67 | { |
||
68 | $result = $this->pool->getItem($id)->clear(); |
||
69 | $this->pool->flush(); |
||
0 ignored issues
–
show
The method
flush() does not seem to exist on object<Stash\Pool> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
70 | |||
71 | return $result; |
||
72 | } |
||
73 | } |
||
74 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.