/
InvocationException.php
103 lines (91 loc) · 2.73 KB
/
InvocationException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
namespace Dhii\Invocation\Exception;
use Dhii\Exception\AbstractBaseException;
use Dhii\Exception\CreateInvalidArgumentExceptionCapableTrait;
use Dhii\I18n\StringTranslatingTrait;
use Dhii\Invocation\ArgsAwareTrait;
use Dhii\Invocation\CallbackAwareTrait;
use Dhii\Util\Normalization\NormalizeIntCapableTrait;
use Dhii\Util\Normalization\NormalizeIterableCapableTrait;
use Dhii\Util\Normalization\NormalizeStringCapableTrait;
use Dhii\Util\String\StringableInterface as Stringable;
use Exception as RootException;
/**
* Concrete implementation for an exception that occurs in relation to an invocation.
*
* @since [*next-version*]
*/
class InvocationException extends AbstractBaseException implements InvocationExceptionInterface
{
/*
* Provides awareness of, and storage functionality for, a callable.
*
* @since [*next-version*]
*/
use CallbackAwareTrait {
_getCallback as public getCallable;
}
/*
* Provides awareness of, and storage functionality, for arguments.
*
* @since [*next-version*]
*/
use ArgsAwareTrait {
_getArgs as public getArgs;
}
/*
* Adds string normalization functionality.
*
* @since [*next-version*]
*/
use NormalizeStringCapableTrait;
/*
* Adds integer normalization functionality.
*
* @since [*next-version*]
*/
use NormalizeIntCapableTrait;
/*
* Provides iterable normalization functionality.
*
* @since [*next-version*]
*/
use NormalizeIterableCapableTrait;
/*
* Provides string translating capabilities.
*
* @since [*next-version*]
*/
use StringTranslatingTrait;
/*
* Provides functionality for creating invalid argument exceptions.
*
* @since [*next-version*]
*/
use CreateInvalidArgumentExceptionCapableTrait;
/**
* Constructor.
*
* @since [*next-version*]
*
* @param string|Stringable|null $message The error message, if any.
* @param int|null $code The error code, if any.
* @param RootException|null $previous The previous exception for chaining, if any.
* @param callable|null $callable The callable that was invoked and erred, if any.
* @param array|null $args The arguments that the callable was invoked with, if any.
*/
public function __construct(
$message = null,
$code = null,
RootException $previous = null,
callable $callable = null,
$args = null
) {
$args = ($args === null)
? []
: $args;
$this->_initBaseException($message, $code, $previous);
$this->_setCallback($callable);
$this->_setArgs($args);
}
}