Completed
Branch BUG/11268/session-ticket-relea... (71e39e)
by
unknown
25:05 queued 12:44
created

__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 23
Code Lines 16

Duplication

Lines 23
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
eloc 16
nc 4
nop 4
dl 23
loc 23
rs 9.0856
c 2
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\services\request;
4
5
use EventEspresso\core\exceptions\InvalidDataTypeException;
6
use Exception;
7
8
defined('EVENT_ESPRESSO_VERSION') || exit;
9
10
11
12
/**
13
 * Class InvalidRequestStackMiddlewareException
14
 *
15
 * @package EventEspresso\core\services\request
16
 * @author  Brent Christensen
17
 * @since   $VID:$
18
 */
19 View Code Duplication
class InvalidRequestStackMiddlewareException extends InvalidDataTypeException
20
{
21
22
    /**
23
     * @param  mixed     $middleware_app_class
24
     * @param  string    $message
25
     * @param int        $code
26
     * @param Exception $previous
27
     */
28
    public function __construct($middleware_app_class, $message = '', $code = 0, Exception $previous = null)
29
    {
30
        if(is_array($middleware_app_class)) {
31
            $middleware_app_class = reset($middleware_app_class);
32
        }
33
        if (empty($message)) {
34
            $message = sprintf(
35
                esc_html__(
36
                    'The supplied Request Stack Middleware class "%1$s" is invalid or could no be found.',
37
                    'event_espresso'
38
                ),
39
                $middleware_app_class
40
            );
41
        }
42
        parent::__construct(
43
            '$middleware_app_class',
44
            $middleware_app_class,
45
            'EventEspresso\core\services\request\middleware\Middleware',
46
            $message,
47
            $code,
48
            $previous
49
        );
50
    }
51
}
52