Completed
Branch BUG/reg-status-change-recursio... (2db0c9)
by
unknown
20:03 queued 10:32
created

CollectionLoaderException   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\services\collections;
4
5
use Exception;
6
use RuntimeException;
7
8
/**
9
 * Class CollectionLoaderException
10
 * Thrown when some other exception occurs during the creation and/or loading of a Collection
11
 *
12
 * @package EventEspresso\core\services\collections
13
 * @author  Brent Christensen
14
 * @since   4.9.62.p
15
 */
16 View Code Duplication
class CollectionLoaderException extends RuntimeException
17
{
18
19
    /**
20
     * DuplicateCollectionIdentifierException constructor.
21
     *
22
     * @param Exception $previous
23
     * @param string    $message
24
     * @param int       $code
25
     */
26
    public function __construct(Exception $previous, $message = '', $code = 0)
27
    {
28
        if (empty($message)) {
29
            $message = sprintf(
30
                __(
31
                    'The following error occurred during the creation and/or loading of this collection: %1$s %2$s',
32
                    'event_espresso'
33
                ),
34
                '<br />',
35
                $previous->getMessage()
36
            );
37
        }
38
        parent::__construct($message, $code, $previous);
39
    }
40
}
41