Completed
Push — master ( ed756f...24259c )
by yuuki
9s
created

AnnotationConfiguration   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A ignoredAnnotations() 0 11 4
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;
19
20
use Doctrine\Common\Annotations\AnnotationReader;
21
22
/**
23
 * Class AnnotationConfiguration
24
 */
25
class AnnotationConfiguration
26
{
27
    /** @var array */
28
    protected $configuration;
29
30
    /**
31
     * AnnotationConfiguration constructor.
32
     *
33
     * @param array $configuration
34
     */
35
    public function __construct(array $configuration)
36
    {
37
        $this->configuration = $configuration;
38
    }
39
40
    /**
41
     * Add a new annotation to the globally ignored annotation names with regard to exception handling.
42
     */
43
    public function ignoredAnnotations()
44
    {
45
        if (isset($this->configuration['ignores'])) {
46
            $ignores = $this->configuration['ignores'];
47
            if (count($ignores)) {
48
                foreach ($ignores as $ignore) {
49
                    AnnotationReader::addGlobalIgnoredName($ignore);
50
                }
51
            }
52
        }
53
    }
54
}
55