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.

ReflectionFunction::getParameters()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Wingu\OctopusCore\Reflection;
4
5
use Wingu\OctopusCore\Reflection\Exceptions\RuntimeException;
6
7
/**
8
 * The ReflectionFunction class reports information about a function.
9
 */
10
class ReflectionFunction extends \ReflectionFunction
11
{
12
13
    use ReflectionDocCommentTrait;
14
15
    /**
16
     * Get the body of the function.
17
     *
18
     * @return string
19
     * @throws \Wingu\OctopusCore\Reflection\Exceptions\RuntimeException If the function is internal.
20
     */
21 15
    public function getBody()
22
    {
23 15
        $fileName = $this->getFileName();
24 15
        if ($fileName === false) {
25 3
            throw new RuntimeException('Can not get body of a function that is internal.');
26
        }
27
28 12
        $lines = file($fileName, FILE_IGNORE_NEW_LINES);
29 12
        $lines = array_slice($lines, $this->getStartLine() - 1, ($this->getEndLine() - $this->getStartLine() + 1),
30 12
            true);
31 12
        $lines = implode("\n", $lines);
32
33 12
        $firstBracketPos = strpos($lines, '{');
34 12
        $lastBracketPost = strrpos($lines, '}');
35 12
        $body = substr($lines, $firstBracketPos + 1, $lastBracketPost - $firstBracketPos - 1);
36
37 12
        return trim(rtrim($body), "\n\r");
38
    }
39
40
    /**
41
     * Gets a ReflectionExtension object for the extension which defined the function.
42
     *
43
     * @return \Wingu\OctopusCore\Reflection\ReflectionExtension
44
     */
45 6
    public function getExtension()
46
    {
47 6
        $extensionName = $this->getExtensionName();
48 6
        if ($extensionName !== false) {
49 3
            return new ReflectionExtension($extensionName);
50
        } else {
51 3
            return null;
52
        }
53
    }
54
55
    /**
56
     * Gets parameters.
57
     *
58
     * @return \Wingu\OctopusCore\Reflection\ReflectionParameter[]
59
     */
60 6
    public function getParameters()
61
    {
62 6
        $res = parent::getParameters();
63
64 6
        foreach ($res as $key => $val) {
65 3
            $res[$key] = new ReflectionParameter($this->getName(), $val->getName());
66 2
        }
67
68 6
        return $res;
69
    }
70
}
71