Completed
Branch BUG-10738-inconsistency-in-ses... (860590)
by
unknown
45:05 queued 33:37
created

InvalidStatusException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 25
loc 25
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 14 14 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace EventEspresso\core\exceptions;
4
5
use Exception;
6
use InvalidArgumentException;
7
8
9 View Code Duplication
class InvalidStatusException extends InvalidArgumentException
10
{
11
    /**
12
     * InvalidStatusException constructor.
13
     * @param string $status the invalid status id that was supplied
14
     * @param string $domain the name of the domain, model, or class that the status belongs to
15
     * @param string $message custom message
16
     * @param int $code
17
     * @param Exception|null $previous
18
     */
19
    public function __construct($status, $domain, $message = '', $code = 0, Exception $previous = null)
20
    {
21
        if (empty($message)) {
22
            $message = sprintf(
23
                __(
24
                    '"%1$s" is not a valid %2$s status',
25
                    'event_espresso'
26
                ),
27
                $status,
28
                $domain
29
            );
30
        }
31
        parent::__construct($message, $code, $previous);
32
    }
33
}
34