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.

Smsa::__callStatic()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SmsaSDK;
4
5
/**
6
 * Smsa
7
 * Smsa Web Services (SECOM) Facade.
8
 */
9
class Smsa
10
{
11
    use MethodsRedirector;
12
    /**
13
     * The base Smsa manager instance.
14
     *
15
     * @var \SmsaSDK\SmsaManager|null
16
     */
17
    private static $smsaManager = null;
18
19
    /**
20
     * setUp
21
     * Set up Smsa Configuration by the given config array
22
     * The array has 'key' and 'uri' as keys to it's values.
23
     *
24
     * @param array|null $config
25
     *
26
     * @return static
27
     */
28 1
    public static function setUp($config = [])
29
    {
30 1
        static::handleStaticCalls('setUp', [$config]);
31
32 1
        return new static();
33
    }
34
35
    /**
36
     * nullValues
37
     * Set the default value of the empty values that shall be sent to SECOM.
38
     *
39
     * @return static
40
     */
41 1
    public static function nullValues($value)
42
    {
43 1
        static::handleStaticCalls('nullValues', [$value]);
44
45 1
        return new static();
46
    }
47
48
    /**
49
     * uri
50
     * Set the WSDL uri.
51
     *
52
     * @return static
53
     */
54
    public static function uri($uri)
55
    {
56
        static::handleStaticCalls('uri', [$uri]);
57
58
        return new static();
59
    }
60
61
    /**
62
     * key
63
     * Set the SMSA Key.
64
     *
65
     * @return static
66
     */
67 2
    public static function key($passkey)
68
    {
69 2
        static::handleStaticCalls('key', [$passkey]);
70
71 2
        return new static();
72
    }
73
74
    /**
75
     * __callStatic
76
     * Calling static methods.
77
     *
78
     * @param string $method
79
     * @param array  $arguments
80
     *
81
     * @return
82
     */
83 7
    public static function __callStatic($method, $arguments)
84
    {
85 7
        return static::handleStaticCalls($method, $arguments);
86
    }
87
88
    /**
89
     * handleStaticCalls.
90
     *
91
     * @param string $method
92
     * @param array  $arguments
93
     *
94
     * @return
95
     */
96 8
    public static function handleStaticCalls($method, $arguments)
97
    {
98 8
        if (empty(static::$smsaManager)) {
0 ignored issues
show
Bug introduced by
Since $smsaManager is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $smsaManager to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
99 1
            static::setManager();
100 1
        }
101
102 8
        return static::$smsaManager->{$method}(...$arguments);
0 ignored issues
show
Bug introduced by
Since $smsaManager is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $smsaManager to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
103
    }
104
105
    /**
106
     * setManager
107
     * Set the base Smsa manager.
108
     *
109
     * @param SmsaSDK\SmsaManager|null|mixed $smsaManager
110
     *
111
     * @return void
112
     */
113 6
    protected static function setManager($smsaManager = null)
114
    {
115 6
        static::$smsaManager = $smsaManager ?: new SmsaManager();
0 ignored issues
show
Bug introduced by
Since $smsaManager is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $smsaManager to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
116 6
    }
117
118
    /**
119
     * refresh
120
     * Refresh the Smsa manager instance by providing alternative instance if possible.
121
     *
122
     * @param SmsaSDK\SmsaManager|null|mixed $altSmsaManagaer
123
     *
124
     * @return void
125
     */
126 5
    public static function refresh($altSmsaManagaer = null)
127
    {
128 5
        static::setManager($altSmsaManagaer);
129 5
    }
130
}
131