GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Descriptor::describeTask()   B
last analyzed

Complexity

Conditions 6
Paths 5

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 15
nc 5
nop 1
dl 0
loc 24
rs 8.5125
c 0
b 0
f 0
1
<?php
2
/**
3
 * See class comment
4
 *
5
 * PHP Version 5
6
 *
7
 * @category Netresearch
8
 * @package  Netresearch\Kite\Service
9
 * @author   Christian Opitz <[email protected]>
10
 * @license  http://www.netresearch.de Netresearch Copyright
11
 * @link     http://www.netresearch.de
12
 */
13
14
namespace Netresearch\Kite\Service;
15
use Netresearch\Kite\Exception;
16
use Netresearch\Kite\Task;
17
18
/**
19
 * Class TaskDescriptor
20
 *
21
 * @category Netresearch
22
 * @package  Netresearch\Kite\Service
23
 * @author   Christian Opitz <[email protected]>
24
 * @license  http://www.netresearch.de Netresearch Copyright
25
 * @link     http://www.netresearch.de
26
 */
27
class Descriptor
28
{
29
    /**
30
     * Describe a task
31
     *
32
     * @param Task $task The task
33
     *
34
     * @return mixed|string
35
     */
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
}
61
?>
62