Test Setup Failed
Push — master ( 665277...008233 )
by Php Easy Api
03:42
created

ExceptionManager::fileNotFoundException()   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
 * @property void notFound
21
 */
22
class ExceptionManager extends ExceptionTrace implements ExceptionContracts
23
{
24
    /**
25
     * invalid argument exception
26
     *
27
     * @param null|string $msg
28
     */
29
    public function invalidArgument($msg=null)
30
    {
31
        throw new InvalidArgumentException($msg);
32
    }
33
34
    /**
35
     * bad function call exception
36
     *
37
     * @param null|string $msg
38
     */
39
    public function badFunctionCall($msg=null)
40
    {
41
        throw new BadFunctionCallException($msg);
42
    }
43
44
    /**
45
     * bad method call
46
     *
47
     * @param null|string $msg
48
     */
49
    public function badMethodCall($msg=null)
50
    {
51
        throw new BadMethodCallException($msg);
52
    }
53
54
    /**
55
     * domain exception
56
     *
57
     * @param null|string $msg
58
     */
59
    public function domain($msg=null)
60
    {
61
        throw new DomainException($msg);
62
    }
63
64
    /**
65
     * length exception
66
     *
67
     * @param null|string $msg
68
     */
69
    public function length($msg=null)
70
    {
71
        throw new LengthException($msg);
72
    }
73
74
    /**
75
     * logic exception
76
     *
77
     * @param null|string $msg
78
     */
79
    public function logic($msg=null)
80
    {
81
        throw new LogicException($msg);
82
    }
83
84
    /**
85
     * not found exception
86
     *
87
     * @param null|string $msg
88
     * @return mixed|void
89
     *
90
     */
91
    public function notFoundException($msg=null)
92
    {
93
        return $this->notFound($msg);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->notFound($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 notFound() 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

93
        return $this->/** @scrutinizer ignore-call */ notFound($msg);
Loading history...
94
    }
95
96
    /**
97
     * file not found exception
98
     *
99
     * @param null|string $msg
100
     * @return mixed|void
101
     *
102
     */
103
    public function fileNotFoundException($msg=null)
104
    {
105
        return $this->fileNotFound($msg);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->fileNotFound($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 fileNotFound() 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

105
        return $this->/** @scrutinizer ignore-call */ fileNotFound($msg);
Loading history...
106
    }
107
108
    /**
109
     * out of range exception
110
     *
111
     * @param null|string $msg
112
     */
113
    public function outOfRange($msg=null)
114
    {
115
        throw new OutOfRangeException($msg);
116
    }
117
118
    /**
119
     * overflow exception
120
     *
121
     * @param null|string $msg
122
     */
123
    public function overflow($msg=null)
124
    {
125
        throw new OverflowException($msg);
126
    }
127
128
    /**
129
     * range exception
130
     *
131
     * @param null|string $msg
132
     */
133
    public function range($msg=null)
134
    {
135
        throw new RangeException($msg);
136
    }
137
138
    /**
139
     * runtime exception
140
     *
141
     * @param null|string $msg
142
     */
143
    public function runtime($msg=null)
144
    {
145
        throw new RuntimeException($msg);
146
    }
147
148
    /**
149
     * underflow exception
150
     *
151
     * @param null|string $msg
152
     */
153
    public function underflow($msg=null)
154
    {
155
        throw new UnderflowException($msg);
156
    }
157
158
    /**
159
     * unexpexted value exception
160
     *
161
     * @param null|string $msg
162
     */
163
    public function unexpectedValue($msg=null)
164
    {
165
        throw new UnexpectedValueException($msg);
166
    }
167
}