Completed
Push — master ( bde278...56c4be )
by Alexander
9s
created

Fetcher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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
    public function __construct($expectedAnnotationType)
24
    {
25
        $this->expectedAnnotationType = $expectedAnnotationType;
26
    }
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