Completed
Branch BUG/11475/decode-site-title-fo... (bbd86e)
by
unknown
13:39 queued 25s
created

ModelFactory::getModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\services\factories;
4
5
use EE_Error;
6
use EE_Registry;
7
use EEM_Base;
8
use EventEspresso\core\exceptions\InvalidDataTypeException;
9
use EventEspresso\core\exceptions\InvalidInterfaceException;
10
use InvalidArgumentException;
11
use ReflectionException;
12
13
defined('EVENT_ESPRESSO_VERSION') || exit;
14
15
16
17
/**
18
 * Class ModelFactory
19
 * retrieves a shared instance of a model
20
 *
21
 * @package EventEspresso\core\domain\services\factories
22
 * @author  Brent Christensen
23
 * @since   $VID:$
24
 */
25
class ModelFactory
26
{
27
28
    /**
29
     * @param string $model_name
30
     * @return bool|EEM_Base
31
     * @throws EE_Error
32
     * @throws InvalidDataTypeException
33
     * @throws InvalidInterfaceException
34
     * @throws InvalidArgumentException
35
     * @throws ReflectionException
36
     */
37
    public static function getModel($model_name)
38
    {
39
        return EE_Registry::instance()->load_model($model_name);
40
    }
41
}
42