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.
Completed
Push — master ( aa4ff3...5266c0 )
by Alex
22:35
created

StaticMethod   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 80
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getType() 0 4 1
A invoke() 0 4 1
A getReflectionMethod() 0 8 2
1
<?php
2
/**
3
 * This file is part of the Global Trading Technologies Ltd workflow-extension-bundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * (c) fduch <[email protected]>
9
 *
10
 * Date: 14.09.16
11
 */
12
13
namespace Gtt\Bundle\WorkflowExtensionsBundle\Action\Reference;
14
15
use ReflectionMethod;
16
17
/**
18
 * Reference to static class method
19
 *
20
 * @author fduch <[email protected]>
21
 */
22
class StaticMethod implements ActionReferenceInterface
23
{
24
    /**
25
     * FQCN which static method is used as an action
26
     *
27
     * @var string|null
28
     */
29
    private $className;
30
31
    /**
32
     * Method name used as action
33
     *
34
     * @var string
35
     */
36
    private $methodName;
37
38
    /**
39
     * Action type
40
     *
41
     * @var string
42
     */
43
    private $type;
44
45
    /**
46
     * Action method reflection
47
     *
48
     * @var ReflectionMethod
49
     */
50
    private $reflectionMethod;
51
52
    /**
53
     * ActionReference constructor.
54
     *
55
     * @param string $methodName method name
56
     * @param string $className  FQCN of the class which method is used as an action
57
     * @param string $type       action reference type
58
     */
59
    public function __construct($methodName, $className, $type = self::TYPE_REGULAR)
60
    {
61
        $this->methodName = $methodName;
62
        $this->className  = $className;
63
        $this->type       = $type;
64
    }
65
66
    /**
67
     * Returns action type
68
     *
69
     * @return string
70
     */
71
    public function getType()
72
    {
73
        return $this->type;
74
    }
75
76
    /**
77
     * Invokes action
78
     *
79
     * @param array $args action args
80
     *
81
     * @return mixed
82
     */
83
    public function invoke(array $args)
84
    {
85
        return $this->getReflectionMethod()->invokeArgs(null, $args);
86
    }
87
88
    /**
89
     * Returns reflection method
90
     *
91
     * @return ReflectionMethod
92
     */
93
    private function getReflectionMethod()
94
    {
95
        if (!$this->reflectionMethod) {
96
            $this->reflectionMethod = new ReflectionMethod($this->className, $this->methodName);
97
        }
98
99
        return $this->reflectionMethod;
100
    }
101
}