Completed
Branch FET/rest-relation-endpoints (02db8d)
by
unknown
27:05 queued 18:22
created

ModelConfigurationException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
1
<?php
2
3
namespace EventEspresso\core\exceptions;
4
5
use DomainException;
6
use EEM_Base;
7
use Exception;
8
9
/**
10
 * Class ModelConfigurationException
11
 *
12
 * Exception thrown because an EE model was misconfigured (eg didn't have a property set, or it was improperly set).
13
 *
14
 * @package     Event Espresso
15
 * @author         Mike Nelson
16
 * @since         4.9.74.p
17
 *
18
 */
19
class ModelConfigurationException extends DomainException
20
{
21
    /**
22
     * ModelConfigurationException constructor.
23
     *
24
     * @param EEM_Base $model
25
     * @param string $message Describe what's misconfigured about this model (don't bother mentioning which model,
26
     * that will be automatically added to the message based on the $model provided in the previous parameter).
27
     * @param int $code
28
     * @param Exception $previous
29
     */
30
    public function __construct(EEM_Base $model, $message, $code = 0, Exception $previous = null)
31
    {
32
        $message_part_1 = sprintf(
33
            /*
34
             * translators: 1: the model name
35
             */
36
            esc_html__('The model "%1$s" appears to be misconfigured.', 'event_espresso'),
37
            $model->get_this_model_name()
38
        );
39
        $message = $message_part_1 . ' ' . $message;
40
        parent::__construct($message, $code, $previous);
41
    }
42
}
43
// End of file ModelConfigurationException.php
44
// Location: EventEspresso\core\exceptions/ModelConfigurationException.php
45