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);
|
|
|
|
|
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
|
|
|
} |
This check looks for function or method calls that always return null and whose return value is used.
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.