Completed
Push — master ( 89b65c...bde278 )
by Alexander
02:30
created

Fetcher::getContractAnnotations()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
crap 3
1
<?php
2
/**
3
 * PHP Deal framework
4
 *
5
 * @copyright Copyright 2014, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace PhpDeal\Contract\Fetcher\ParentClass;
12
13
class Fetcher
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $expectedAnnotationType;
19
20
    /**
21
     * @param string $expectedAnnotationType
22
     */
23 34
    public function __construct($expectedAnnotationType)
24
    {
25 34
        $this->expectedAnnotationType = $expectedAnnotationType;
26 34
    }
27
28
    /**
29
     * @param array $annotations
30
     * @return array
31
     */
32 12
    protected function getContractAnnotations(array $annotations)
33
    {
34 12
        $contractAnnotations = [];
35
36 12
        foreach ($annotations as $annotation) {
37 12
            if (is_a($annotation, $this->expectedAnnotationType)) {
38 12
                $contractAnnotations[] = $annotation;
39
            }
40
        }
41
42 12
        return $contractAnnotations;
43
    }
44
}
45