Completed
Branch final (ad8b8d)
by Georges
03:08 queued 28s
created

DriverAbstract::search()   F

Complexity

Conditions 18
Paths 365

Size

Total Lines 48
Code Lines 31

Duplication

Lines 12
Ratio 25 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
cc 18
eloc 31
c 4
b 0
f 1
nc 365
nop 2
dl 12
loc 48
rs 3.6714

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 *
4
 * This file is part of phpFastCache.
5
 *
6
 * @license MIT License (MIT)
7
 *
8
 * For full copyright and license information, please see the docs/CREDITS.txt file.
9
 *
10
 * @author Khoa Bui (khoaofgod)  <[email protected]> http://www.phpfastcache.com
11
 * @author Georges.L (Geolim4)  <[email protected]>
12
 *
13
 */
14
15
namespace phpFastCache\Core;
16
17
use phpFastCache\Cache\DriverBaseTrait;
18
use phpFastCache\Cache\ExtendedCacheItemPoolInterface;
19
use Psr\Cache\CacheItemInterface;
20
21
/**
22
 * Class DriverAbstract
23
 * @package phpFastCache\Core
24
 */
25
abstract class DriverAbstract implements ExtendedCacheItemPoolInterface
26
{
27
    use DriverBaseTrait;
28
29
    const DRIVER_CHECK_FAILURE      = '%s is not installed or is misconfigured, cannot continue.';
30
    const DRIVER_TAGS_KEY_PREFIX    = '_TAG_';
31
    const DRIVER_DATA_WRAPPER_INDEX = 'd';
32
    const DRIVER_TIME_WRAPPER_INDEX = 't';
33
    const DRIVER_TAGS_WRAPPER_INDEX = 'g';
34
35
    /**
36
     * @param \Psr\Cache\CacheItemInterface $item
37
     * @return array [
38
     *      'd' => 'THE ITEM DATA'
39
     *      't' => 'THE ITEM DATE EXPIRATION'
40
     *      'g' => 'THE ITEM TAGS'
41
     * ]
42
     *
43
     */
44
    abstract protected function driverRead(CacheItemInterface $item);
45
46
    /**
47
     * @param \Psr\Cache\CacheItemInterface $item
48
     * @return mixed
49
     */
50
    abstract protected function driverWrite(CacheItemInterface $item);
51
52
    /**
53
     * @return bool
54
     */
55
    abstract protected function driverClear();
56
57
    /**
58
     * @return bool
59
     */
60
    abstract protected function driverConnect();
61
62
    /**
63
     * @param \Psr\Cache\CacheItemInterface $item
64
     * @return bool
65
     */
66
    abstract protected function driverDelete(CacheItemInterface $item);
67
}