ArgumentNotAClosureException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __construct() 0 7 1
1
<?php
2
3
/**
4
 * Custom exception for not a Closure arguments.
5
 *
6
 * PHP version 7.4
7
 *
8
 * @category Exceptions
9
 * @package  Chaospelt\Kernel\Exceptions
10
 *
11
 * @author  Stf Kolev <[email protected]>
12
 * @license BSD-3-Clause https://opensource.org/licenses/BSD-3-Clause
13
 *
14
 * @link https://github.com/stfkolev/chaospelt
15
 */
16
namespace Chaospelt\Kernel\Exceptions;
17
18
use Exception;
19
use Throwable;
20
21
/**
22
 * Custom exception for not a Closure arguments
23
 *
24
 * @category Exceptions
25
 * @package  Chaospelt\Kernel\Exceptions
26
 *
27
 * @author  Stf Kolev <[email protected]>
28
 * @license BSD-3-Clause https://opensource.org/licenses/BSD-3-Clause
29
 *
30
 * @link https://github.com/stfkolev/chaospelt
31
 */
32
class ArgumentNotAClosureException extends Exception
33
{
34
    /**
35
     * Redefine exception, so the message is not an optional parameter
36
     *
37
     * @param string    $message  Message of the Exception
38
     * @param number    $code     Code of the exception
39
     * @param Throwable $previous Previously thrown exception
40
     * 
41
     * @return void
42
     */
43
    public function __construct($message = '', $code = 0, Throwable $previous = null)
44
    {
45
        $message = 'Argument is not a Closure';
46
        $code = 4413;
47
48
        // make sure everything is assigned properly
49
        parent::__construct($message, $code, $previous);
50
    }
51
52
    /**
53
     * Custom string representation of the object
54
     * 
55
     * @return string
56
     */
57
    public function __toString() 
58
    {
59
        return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
60
    }
61
}
62