Completed
Push — master ( 4ada12...4bd1d2 )
by yuuki
13s
created

ApcuReader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getReader() 0 9 2
1
<?php
2
3
/**
4
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10
 * THE SOFTWARE.
11
 *
12
 * This software consists of voluntary contributions made by many individuals
13
 * and is licensed under the MIT license.
14
 *
15
 * Copyright (c) 2015-2016 Yuuki Takezawa
16
 *
17
 */
18
namespace Ytake\LaravelAspect\Annotation\Reader;
19
20
use Doctrine\Common\Cache\ApcCache;
21
use Doctrine\Common\Cache\ApcuCache;
22
use Doctrine\Common\Annotations\CachedReader;
23
use Doctrine\Common\Annotations\AnnotationReader;
24
25
/**
26
 * Class ApcuReader
27
 */
28
class ApcuReader implements AnnotationReadable
29
{
30
    /** @var string[] */
31
    protected $config;
32
33
    /**
34
     * @param array $config
35
     */
36
    public function __construct(array $config)
37
    {
38
        $this->config = $config;
39
    }
40
41
    /**
42
     * @return CachedReader
43
     */
44
    public function getReader()
45
    {
46
        $extension = (extension_loaded('apcu')) ? new ApcuCache : new ApcCache;
0 ignored issues
show
Deprecated Code introduced by
The class Doctrine\Common\Cache\ApcCache has been deprecated with message: since version 1.6, use ApcuCache instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
47
        return new CachedReader(
48
            new AnnotationReader(),
49
            $extension,
50
            (bool) $this->config['debug']
51
        );
52
    }
53
}
54