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

FileReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getReader() 0 8 1
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\FilesystemCache;
21
use Doctrine\Common\Annotations\CachedReader;
22
use Doctrine\Common\Annotations\AnnotationReader;
23
24
/**
25
 * Class FileReader
26
 */
27
class FileReader implements AnnotationReadable
28
{
29
    /** @var string[] */
30
    protected $config;
31
32
    /**
33
     * @param array $config
34
     */
35
    public function __construct(array $config)
36
    {
37
        $this->config = $config;
38
    }
39
40
    /**
41
     * @return CachedReader
42
     */
43
    public function getReader()
44
    {
45
        return new CachedReader(
46
            new AnnotationReader(),
47
            new FilesystemCache($this->config['cache_dir']),
48
            (bool) $this->config['debug']
49
        );
50
    }
51
}
52