Conditions | 6 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function describeTask(Task $task) |
||
37 | { |
||
38 | $description = $task->get('description', null); |
||
39 | |||
40 | if (!$description) { |
||
41 | $reflection = new \ReflectionClass($task); |
||
42 | |||
43 | if ($reflection->getNamespaceName() === 'Netresearch\\Kite') { |
||
44 | $taskProperty = new \ReflectionProperty('Netresearch\\Kite\\Tasks', 'tasks'); |
||
45 | $taskProperty->setAccessible(true); |
||
46 | foreach ($taskProperty->getValue($task) as $subTask) { |
||
47 | $description .= "\n\n" . $this->describeTask($subTask); |
||
48 | } |
||
49 | $description = trim($description); |
||
50 | if (!$description) { |
||
51 | $description = 'Generic ' . $reflection->getName(); |
||
52 | } |
||
53 | } elseif (preg_match_all('/^ \* ([^@ \n].+|)$/mU', $reflection->getDocComment(), $matches, PREG_PATTERN_ORDER)) { |
||
54 | $description = trim(implode("\n", $matches[1])); |
||
55 | } |
||
56 | } |
||
57 | |||
58 | return $description; |
||
59 | } |
||
60 | } |
||
62 |