Completed
Branch BUG-9871-email-validation (e62b1a)
by
unknown
350:41 queued 333:27
created

__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 22
Code Lines 16

Duplication

Lines 22
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
eloc 16
c 0
b 0
f 0
nc 4
nop 4
dl 22
loc 22
rs 9.2
1
<?php
2
namespace EventEspresso\core\services\commands\middleware;
3
4
use EventEspresso\core\exceptions\InvalidDataTypeException;
5
6
if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
    exit('No direct script access allowed');
8
}
9
10
11
12
/**
13
 * Class InvalidCommandBusMiddlewareException
14
 *
15
 * thrown when an invalid object is encountered when processing CommandBus middleware
16
 *
17
 * @package       Event Espresso
18
 * @author        Brent Christensen
19
 * @since         4.9.1
20
 *
21
 */
22 View Code Duplication
class InvalidCommandBusMiddlewareException extends InvalidDataTypeException
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
{
24
25
26
    /**
27
     * @access public
28
     * @param  mixed     $command_bus_middleware_object
29
     * @param  string    $message
30
     * @param int        $code
31
     * @param \Exception $previous
32
     */
33
    public function __construct($command_bus_middleware_object, $message = '', $code = 0, \Exception $previous = null)
34
    {
35
        $command_bus_middleware = is_object($command_bus_middleware_object)
36
            ? get_class($command_bus_middleware_object)
37
            : gettype($command_bus_middleware_object);
38
39
        if (empty($message)) {
40
            $message = sprintf(
41
                __('The supplied Command Bus Middleware "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ',
42
                    'event_espresso'),
43
                $command_bus_middleware
44
            );
45
        }
46
        parent::__construct(
47
            '$command_bus_middleware',
48
            $command_bus_middleware,
49
            'CommandBusMiddlewareInterface',
50
            $message,
51
            $code,
52
            $previous
53
        );
54
    }
55
56
57
}
58
// End of file InvalidCommandBusMiddlewareException.php
59
// Location: /InvalidCommandBusMiddlewareException.php