Completed
Push — master ( a0b6f6...c4f43b )
by Arman
21s queued 17s
created

ViewFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 30
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 12 2
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.9.7
13
 */
14
15
namespace Quantum\View\Factories;
16
17
use Quantum\Libraries\Config\Exceptions\ConfigException;
18
use Quantum\Renderer\Factories\RendererFactory;
19
use Quantum\Libraries\ResourceCache\ViewCache;
20
use Quantum\Libraries\Asset\AssetManager;
21
use Quantum\Di\Exceptions\DiException;
22
use Quantum\Exceptions\BaseException;
23
use DebugBar\DebugBarException;
24
use Quantum\Debugger\Debugger;
25
use Quantum\View\QtView;
26
use ReflectionException;
27
28
/**
29
 * Class ViewFactory
30
 * @package Quantum\View
31
 * @mixin QtView
32
 */
33
class ViewFactory
34
{
35
36
    /**
37
     * Instance of QtView
38
     * @var QtView|null
39
     */
40
    private static $instance = null;
41
42
    /**
43
     * QtView instance
44
     * @return QtView
45
     * @throws DebugBarException
46
     * @throws DiException
47
     * @throws BaseException
48
     * @throws ConfigException
49
     * @throws ReflectionException
50
     */
51
    public static function get(): QtView
52
    {
53
        if (self::$instance === null) {
54
            self::$instance = new QtView(
55
                RendererFactory::get(),
56
                AssetManager::getInstance(),
57
                Debugger::getInstance(),
58
                ViewCache::getInstance()
59
            );
60
        }
61
62
        return self::$instance;
63
    }
64
}
65