Completed
Branch GDPR/erasure (847b68)
by
unknown
40:32 queued 27:22
created

__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 4
dl 14
loc 14
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\services\collections;
4
5
use Exception;
6
use OutOfBoundsException;
7
8
/**
9
 * Class InvalidCollectionIdentifierException
10
 * Thrown when the supplied identifier doesn't exist in a Collection when trying to retrieve an item
11
 *
12
 * @package EventEspresso\core\services\collections
13
 * @author  Brent Christensen
14
 * @since   $VID:$
15
 */
16 View Code Duplication
class InvalidCollectionIdentifierException extends OutOfBoundsException
17
{
18
19
    /**
20
     * InvalidCollectionIdentifierException constructor.
21
     *
22
     * @param                $identifier
23
     * @param string         $message
24
     * @param int            $code
25
     * @param Exception|null $previous
26
     */
27
    public function __construct($identifier, $message = '', $code = 0, Exception $previous = null)
28
    {
29
        if (empty($message)) {
30
            $message = sprintf(
31
                __(
32
                    'The supplied identifier "%1$s" does not exist within this collection. 
33
                    You may need to delay adding this asset until the required dependency has been added.',
34
                    'event_espresso'
35
                ),
36
                $identifier
37
            );
38
        }
39
        parent::__construct($message, $code, $previous);
40
    }
41
}
42