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

AnnotationConfiguration::ignoredAnnotations()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.2
c 0
b 0
f 0
cc 4
eloc 6
nc 4
nop 0
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