Total Complexity | 9 |
Total Lines | 92 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | class SubAction |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | private $name; |
||
15 | |||
16 | /** |
||
17 | * @var (Type|null)[] |
||
18 | */ |
||
19 | private $arguments; |
||
20 | |||
21 | /** |
||
22 | * @var Type|null |
||
23 | */ |
||
24 | private $returnTypehint; |
||
25 | |||
26 | /** |
||
27 | * @var ReflectionMethod |
||
28 | */ |
||
29 | private $reflectionMethod; |
||
30 | |||
31 | /** |
||
32 | * @var object|null |
||
33 | */ |
||
34 | private $object; |
||
35 | |||
36 | /** |
||
37 | * @param string $name |
||
38 | * @param (Type|null)[] $arguments |
||
39 | * @param ReflectionMethod $reflectionMethod |
||
40 | * @param Type|null $returnTypehint |
||
41 | * @param object|null $object |
||
42 | */ |
||
43 | public function __construct(string $name, array $arguments, ReflectionMethod $reflectionMethod, ?Type $returnTypehint, ?object $object) { |
||
44 | $this->name = $name; |
||
45 | $this->arguments = $arguments; |
||
46 | $this->reflectionMethod = $reflectionMethod; |
||
47 | $this->returnTypehint = $returnTypehint; |
||
48 | $this->object = $object; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | public function getName(): string |
||
55 | { |
||
56 | return $this->name; |
||
57 | } |
||
58 | |||
59 | public function getSummary(): ?string |
||
60 | { |
||
61 | $factory = DocBlockFactory::createInstance(); |
||
62 | $docComment = $this->reflectionMethod->getDocComment(); |
||
63 | var_dump($docComment); |
||
|
|||
64 | if (!$docComment) { |
||
65 | return null; |
||
66 | } |
||
67 | $docblock = $factory->create($docComment); |
||
68 | return $docblock->getDescription() ? : null; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return Type[] |
||
73 | */ |
||
74 | public function getArguments(): array |
||
75 | { |
||
76 | return $this->arguments; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @return Type|null |
||
81 | */ |
||
82 | public function getReturnTypehint(): ?Type |
||
83 | { |
||
84 | return $this->returnTypehint; |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * @return ReflectionMethod |
||
89 | */ |
||
90 | public function getReflectionMethod(): ReflectionMethod |
||
91 | { |
||
92 | return $this->reflectionMethod; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @return object|null |
||
97 | */ |
||
98 | public function getObject(): ?object |
||
101 | } |
||
102 | } |
||
103 |