ResultFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
c 2
b 1
f 0
lcom 1
cbo 2
dl 0
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createClassResults() 0 5 1
A createTraitResults() 0 5 1
1
<?php
2
3
/**
4
 * This file is part of cloak.
5
 *
6
 * (c) Noritaka Horio <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace cloak\result;
13
14
use cloak\result\collection\CoverageResultCollection;
15
use cloak\reflection\FileReflection;
16
use cloak\result\type\ClassResult;
17
use cloak\result\type\TraitResult;
18
19
20
/**
21
 * Class ResultFactory
22
 * @package cloak\result
23
 */
24
class ResultFactory
25
{
26
27
    /**
28
     * @var FileReflection
29
     */
30
    private $fileReflection;
31
32
33
    /**
34
     * @param FileReflection $fileReflection
35
     */
36
    public function __construct(FileReflection $fileReflection)
37
    {
38
        $this->fileReflection = $fileReflection;
39
    }
40
41
    /**
42
     * @param LineResultSelectable $lineCoverages
43
     * @return CoverageResultCollection
44
     */
45
    public function createClassResults(LineResultSelectable $lineCoverages)
46
    {
47
        $reflections = $this->fileReflection->getClasses();
48
        return $reflections->convertToResult($lineCoverages);
49
    }
50
51
    /**
52
     * @param LineResultSelectable $lineCoverages
53
     * @return CoverageResultCollection
54
     */
55
    public function createTraitResults(LineResultSelectable $lineCoverages)
56
    {
57
        $reflections = $this->fileReflection->getTraits();
58
        return $reflections->convertToResult($lineCoverages);
59
    }
60
61
}
62