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

InvariantFetcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConditions() 0 14 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
use Doctrine\Common\Annotations\Reader;
14
use ReflectionClass;
15
16
class InvariantFetcher extends Fetcher
17
{
18
    /**
19
     * @param ReflectionClass $class
20
     * @param Reader $reader
21
     * @param array $contracts
22
     * @return array
23
     */
24 7
    public function getConditions(ReflectionClass $class, Reader $reader, array $contracts = [])
25
    {
26 7
        $parentClass = $class->getParentClass();
27
28 7
        if (!$parentClass) {
29 7
            return $contracts;
30
        }
31
32 4
        $annotations = $reader->getClassAnnotations($parentClass);
33 4
        $contractAnnotations = $this->getContractAnnotations($annotations);
34 4
        $contracts = array_merge($contracts, $contractAnnotations);
35
36 4
        return $this->getConditions($parentClass, $reader, $contracts);
37
    }
38
}
39