Layout::initInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
c 0
b 0
f 0
cc 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Proxy;
13
14
use Bluz\Common\Container\RegularAccess;
15
use Bluz\Common\Exception\CommonException;
16
use Bluz\Layout\Layout as Instance;
0 ignored issues
show
Bug introduced by
The type Bluz\Layout\Layout was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Bluz\View\View;
18
19
/**
20
 * Proxy to Layout
21
 *
22
 * Example of usage
23
 * <code>
24
 *     use Bluz\Proxy\Layout;
25
 *
26
 *     Layout::title('Homepage');
27
 *     Layout::set('description', 'some page description');
28
 * </code>
29
 *
30
 * @package  Bluz\Proxy
31
 * @author   Anton Shevchuk
32
 *
33
 * @method   static Instance getInstance()
34
 *
35
 * @method   static View getContent()
36
 * @see      Instance::getContent()
37
 * @method   static void setContent($content)
38
 * @see      Instance::setContent()
39
 * @method   static void setPath($path)
40
 * @see      View::setPath()
41
 * @method   static string getPath()
42
 * @see      View::getPath()
43
 * @method   static void setTemplate($file)
44
 * @see      View::setTemplate()
45
 * @method   static string getTemplate()
46
 * @see      View::getTemplate()
47
 *
48
 * @method   static void set($key, $value)
49
 * @see      RegularAccess::set()
50
 * @method   static mixed get($key)
51
 * @see      RegularAccess::get()
52
 * @method   static bool contains($key)
53
 * @see      RegularAccess::contains()
54
 * @method   static void delete($key)
55
 * @see      RegularAccess::delete()
56
 *
57
 * @method static string ahref(string $text, mixed $href, array $attributes = [])
58
 * @method static array|null breadCrumbs(array $data = [])
59
 * @method static string|null headScript(string $src = null, array $attributes = [])
60
 * @method static string|null headScriptBlock(string $code = null)
61
 * @method static string|null headStyle(string $href = null, string $media = 'all')
62
 * @method static string|null link(string $src = null, string $rel = 'stylesheet')
63
 * @method static string|null meta(string $name = null, string $content = null)
64
 * @method static string|null title(string $title = null)
65
 * @method static string titleAppend(string $title, string $separator = ' :: ')
66
 * @method static string titlePrepend(string $title, string $separator = ' :: ')
67
 */
68
final class Layout
69
{
70
    use ProxyTrait;
71
72
    /**
73
     * Init instance
74
     *
75
     * @return Instance
76
     * @throws CommonException
77
     */
78 9
    private static function initInstance(): Instance
79
    {
80 9
        $instance = new Instance();
81 9
        $instance->setOptions(Config::get('layout'));
82 9
        return $instance;
83
    }
84
}
85