|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* ShouldPHP |
|
4
|
|
|
* |
|
5
|
|
|
* @author Gabriel Jacinto <[email protected]> |
|
6
|
|
|
* @status dev |
|
7
|
|
|
* @link https://github.com/GabrielJMJ/ShouldPHP |
|
8
|
|
|
* @license MIT |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Gabrieljmj\Should\Exception; |
|
12
|
|
|
|
|
13
|
|
|
use Gabrieljmj\Should\Exception\InvalidVisibilityTypeException; |
|
14
|
|
|
use Gabrieljmj\Should\Exception\InvalidTypeHintingException; |
|
15
|
|
|
use Gabrieljmj\Should\Exception\ClassDoesNotExistException; |
|
16
|
|
|
use Gabrieljmj\Should\Exception\PropertyDoesNotExistException; |
|
17
|
|
|
use Gabrieljmj\Should\Exception\MethodDoesNotExistException; |
|
18
|
|
|
use Gabrieljmj\Should\Exception\ParameterDoesNotExistException; |
|
19
|
|
|
|
|
20
|
|
|
class ShouldException |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @param string $type |
|
24
|
|
|
* @throws \Gabrieljmj\Should\Exception\InvalidVisibilityTypeException |
|
25
|
|
|
*/ |
|
26
|
|
|
public static function invalidVisibilityType($type) |
|
27
|
|
|
{ |
|
28
|
|
|
InvalidVisibilityTypeException::trigger($type); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @param string $type |
|
33
|
|
|
* @throws \Gabrieljmj\Should\Exception\InvalidTypeHintingException |
|
34
|
|
|
*/ |
|
35
|
|
|
public static function invalidTypeHinting($type) |
|
36
|
|
|
{ |
|
37
|
|
|
InvalidTypeHintingException::trigger($type); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param string|object $class |
|
42
|
|
|
* @throws \Gabrieljmj\Should\Exception\ClassDoesNotExistException |
|
43
|
|
|
*/ |
|
44
|
|
|
public static function classDoesNotExist($class) |
|
45
|
|
|
{ |
|
46
|
|
|
ClassDoesNotExistException::trigger($class); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param string|object $class |
|
51
|
|
|
* @param string $property |
|
52
|
|
|
* @throws \Gabrieljmj\Should\Exception\PropertyDoesNotExistException |
|
53
|
|
|
*/ |
|
54
|
|
|
public static function propertyDoesNotExist($class, $property) |
|
55
|
|
|
{ |
|
56
|
|
|
PropertyDoesNotExistException::trigger($class, $property); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param string|object $class |
|
61
|
|
|
* @param string $method |
|
62
|
|
|
* @throws \Gabrieljmj\Should\Exception\MethodDoesNotExistException |
|
63
|
|
|
*/ |
|
64
|
|
|
public statiC function methodDoesNotExist($class, $method) |
|
65
|
|
|
{ |
|
66
|
|
|
MethodDoesNotExistException::trigger($class, $method); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @param string|object $class |
|
71
|
|
|
* @param string $method |
|
72
|
|
|
* @param string $parameter |
|
73
|
|
|
* @throws \Gabrieljmj\Should\Exception\ParameterDoesNotExistException |
|
74
|
|
|
*/ |
|
75
|
|
|
public static function parameterDoesNotExist($class, $method, $parameter) |
|
76
|
|
|
{ |
|
77
|
|
|
ParameterDoesNotExistException::trigger($class, $method, $parameter); |
|
78
|
|
|
} |
|
79
|
|
|
} |