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

Fetcher   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 32
ccs 6
cts 9
cp 0.6667
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContractAnnotations() 0 12 3
A __construct() 0 4 1
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