|
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\ClassReflection; |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Class AbstractTypeResult |
|
20
|
|
|
* @package cloak\result |
|
21
|
|
|
*/ |
|
22
|
|
|
abstract class AbstractTypeResult |
|
23
|
|
|
{ |
|
24
|
|
|
|
|
25
|
|
|
use CoverageResult; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var ClassReflection |
|
29
|
|
|
*/ |
|
30
|
|
|
private $reflection; |
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param ClassReflection $reflection |
|
35
|
|
|
* @param LineResultSelectable $selector |
|
36
|
|
|
*/ |
|
37
|
|
|
public function __construct(ClassReflection $reflection, LineResultSelectable $selector) |
|
38
|
|
|
{ |
|
39
|
|
|
$this->reflection = $reflection; |
|
40
|
|
|
$this->lineResults = $selector->selectByReflection($this->reflection); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return string |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getName() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->reflection->getName(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return string |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getNamespaceName() |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->reflection->getNamespaceName(); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @return \cloak\result\CoverageResultNodeCollection |
|
61
|
|
|
*/ |
|
62
|
|
|
public function getMethodResults() |
|
63
|
|
|
{ |
|
64
|
|
|
$results = new CoverageResultCollection(); |
|
65
|
|
|
$methods = $this->reflection->getMethods(); |
|
66
|
|
|
|
|
67
|
|
|
foreach ($methods as $method) { |
|
68
|
|
|
$methodResult = new MethodResult($method, $this->lineResults); |
|
69
|
|
|
$results->add($methodResult); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
return $results; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @return bool |
|
77
|
|
|
*/ |
|
78
|
|
|
public function hasChildResults() |
|
79
|
|
|
{ |
|
80
|
|
|
$methods = $this->reflection->getMethods(); |
|
81
|
|
|
return $methods->isEmpty() === false; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return CoverageResultNodeCollection |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getChildResults() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->getMethodResults(); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
} |
|
93
|
|
|
|