Passed
Push — v9 ( 467cbb...1836cb )
by Georges
03:07 queued 24s
created

Driver::getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 *
5
 * This file is part of Phpfastcache.
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For full copyright and license information, please see the docs/CREDITS.txt and LICENCE files.
10
 *
11
 * @author Georges.L (Geolim4)  <[email protected]>
12
 * @author Contributors  https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors
13
 */
14
15
declare(strict_types=1);
16
17
namespace Phpfastcache\Drivers\Devnull;
18
19
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20
use Phpfastcache\Core\Pool\TaggableCacheItemPoolTrait;
21
use Phpfastcache\Entities\DriverStatistic;
22
use Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException;
23
use Psr\Cache\CacheItemInterface;
24
25
/**
26
 * Class Driver
27
 * @method Config getConfig()
28
 */
29
class Driver implements ExtendedCacheItemPoolInterface
30
{
31
    use TaggableCacheItemPoolTrait;
32
33
    /**
34
     * @return bool
35
     */
36
    public function driverCheck(): bool
37
    {
38
        return true;
39
    }
40
41
    /**
42
     * @return DriverStatistic
43
     */
44
    public function getStats(): DriverStatistic
45
    {
46
        $stat = new DriverStatistic();
47
        $stat->setInfo('[Devnull] A void info string')
48
            ->setSize(0)
49
            ->setData(implode(', ', array_keys($this->itemInstances)))
50
            ->setRawData(null);
51
52
        return $stat;
53
    }
54
55
    /**
56
     * @param CacheItemInterface $item
57
     * @return mixed
58
     * @throws PhpfastcacheInvalidArgumentException
59
     */
60
    protected function driverWrite(CacheItemInterface $item): bool
61
    {
62
        $this->assertCacheItemType($item, Item::class);
63
64
        return true;
65
    }
66
67
    /**
68
     * @param CacheItemInterface $item
69
     * @return null
70
     */
71
    protected function driverRead(CacheItemInterface $item): ?array
1 ignored issue
show
Unused Code introduced by
The parameter $item is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

71
    protected function driverRead(/** @scrutinizer ignore-unused */ CacheItemInterface $item): ?array

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
    {
73
        return null;
74
    }
75
76
    /**
77
     * @param CacheItemInterface $item
78
     * @return bool
79
     * @throws PhpfastcacheInvalidArgumentException
80
     */
81
    protected function driverDelete(CacheItemInterface $item): bool
82
    {
83
        $this->assertCacheItemType($item, Item::class);
84
85
        return true;
86
    }
87
88
    /**
89
     * @return bool
90
     */
91
    protected function driverClear(): bool
92
    {
93
        return true;
94
    }
95
96
    /**
97
     * @return bool
98
     */
99
    protected function driverConnect(): bool
100
    {
101
        return true;
102
    }
103
}
104