Test Setup Failed
Push — master ( cd50bd...239ff9 )
by Php Easy Api
03:23
created

ExceptionManager::length()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Resta\Exception;
4
5
use LogicException;
6
use RangeException;
7
use DomainException;
8
use LengthException;
9
use RuntimeException;
10
use OverflowException;
11
use UnderflowException;
12
use OutOfRangeException;
13
use BadMethodCallException;
14
use UnexpectedValueException;
15
use BadFunctionCallException;
16
use InvalidArgumentException;
17
use Resta\Contracts\ExceptionContracts;
18
19
/**
20
 * @method notFound($name,$arguments=array())
21
 * @method fileNotFound($name,$arguments=array())
22
 */
23
class ExceptionManager extends ExceptionTrace implements ExceptionContracts
24
{
25
    /**
26
     * access denied http exception
27
     *
28
     * @param null|string $msg
29
     * @return null
30
     *
31
     */
32
    public function accessDeniedHttpException($msg=null)
33
    {
34
        return $this->accessDeniedHttp($msg);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->accessDeniedHttp($msg) targeting Resta\Exception\ExceptionManager::__call() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug introduced by
The method accessDeniedHttp() does not exist on Resta\Exception\ExceptionManager. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
        return $this->/** @scrutinizer ignore-call */ accessDeniedHttp($msg);
Loading history...
35
    }
36
37
    /**
38
     * invalid argument exception
39
     *
40
     * @param null|string $msg
41
     */
42
    public function invalidArgument($msg=null)
43
    {
44
        throw new InvalidArgumentException($msg);
45
    }
46
47
    /**
48
     * bad function call exception
49
     *
50
     * @param null|string $msg
51
     */
52
    public function badFunctionCall($msg=null)
53
    {
54
        throw new BadFunctionCallException($msg);
55
    }
56
57
    /**
58
     * bad method call
59
     *
60
     * @param null|string $msg
61
     */
62
    public function badMethodCall($msg=null)
63
    {
64
        throw new BadMethodCallException($msg);
65
    }
66
67
    /**
68
     * domain exception
69
     *
70
     * @param null|string $msg
71
     */
72
    public function domain($msg=null)
73
    {
74
        throw new DomainException($msg);
75
    }
76
77
    /**
78
     * length exception
79
     *
80
     * @param null|string $msg
81
     */
82
    public function length($msg=null)
83
    {
84
        throw new LengthException($msg);
85
    }
86
87
    /**
88
     * logic exception
89
     *
90
     * @param null|string $msg
91
     */
92
    public function logic($msg=null)
93
    {
94
        throw new LogicException($msg);
95
    }
96
97
    /**
98
     * not found exception
99
     *
100
     * @param null|string $msg
101
     * @return null
102
     *
103
     */
104
    public function notFoundException($msg=null)
105
    {
106
        return $this->notFound($msg);
107
    }
108
109
    /**
110
     * file not found exception
111
     *
112
     * @param null|string $msg
113
     * @return mixed|void
114
     *
115
     */
116
    public function fileNotFoundException($msg=null)
117
    {
118
        return $this->fileNotFound($msg);
119
    }
120
121
    /**
122
     * out of range exception
123
     *
124
     * @param null|string $msg
125
     */
126
    public function outOfRange($msg=null)
127
    {
128
        throw new OutOfRangeException($msg);
129
    }
130
131
    /**
132
     * overflow exception
133
     *
134
     * @param null|string $msg
135
     */
136
    public function overflow($msg=null)
137
    {
138
        throw new OverflowException($msg);
139
    }
140
141
    /**
142
     * range exception
143
     *
144
     * @param null|string $msg
145
     */
146
    public function range($msg=null)
147
    {
148
        throw new RangeException($msg);
149
    }
150
151
    /**
152
     * runtime exception
153
     *
154
     * @param null|string $msg
155
     */
156
    public function runtime($msg=null)
157
    {
158
        throw new RuntimeException($msg);
159
    }
160
161
    /**
162
     * underflow exception
163
     *
164
     * @param null|string $msg
165
     */
166
    public function underflow($msg=null)
167
    {
168
        throw new UnderflowException($msg);
169
    }
170
171
    /**
172
     * unexpexted value exception
173
     *
174
     * @param null|string $msg
175
     */
176
    public function unexpectedValue($msg=null)
177
    {
178
        throw new UnexpectedValueException($msg);
179
    }
180
}