Completed
Branch Gutenberg/master (3b2a95)
by
unknown
118:45 queued 105:17
created

InvalidAliasException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 27
loc 27
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 DomainException;
6
use Exception;
7
8
/**
9
 * Class InvalidAliasException
10
 * thrown when a class does not extend or implement the supplied alias
11
 *
12
 * @package       Event Espresso
13
 * @author        Brent Christensen
14
 * @since         4.9.0
15
 */
16 View Code Duplication
class InvalidAliasException extends DomainException
17
{
18
19
    /**
20
     * InvalidClassException constructor.
21
     *
22
     * @param string    $fqcn
23
     * @param string    $alias
24
     * @param string    $message
25
     * @param int       $code
26
     * @param Exception $previous
27
     */
28
    public function __construct($fqcn, $alias, $message = '', $code = 0, Exception $previous = null)
29
    {
30
        if (empty($message)) {
31
            $message = sprintf(
32
                __(
33
                    '"%1$s" can not be used as an alias because the "%2$s"  class does not extend or implement it.',
34
                    'event_espresso'
35
                ),
36
                $alias,
37
                $fqcn
38
            );
39
        }
40
        parent::__construct($message, $code, $previous);
41
    }
42
}
43