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

ModelConfigurationException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
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