Completed
Pull Request — master (#393)
by Anton
04:48
created

Layout   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A initInstance() 0 6 1
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Proxy;
12
13
use Bluz\Common\Container\RegularAccess;
14
use Bluz\Layout\Layout as Instance;
15
use Bluz\View\View;
16
17
/**
18
 * Proxy to Layout
19
 *
20
 * Example of usage
21
 * <code>
22
 *     use Bluz\Proxy\Layout;
23
 *
24
 *     Layout::title('Homepage');
25
 *     Layout::set('description', 'some page description');
26
 * </code>
27
 *
28
 * @package  Bluz\Proxy
29
 * @author   Anton Shevchuk
30
 *
31
 * @method   static Instance getInstance()
32
 *
33
 * @method   static View getContent()
34
 * @see      Instance::getContent()
35
 * @method   static void setContent($content)
36
 * @see      Instance::setContent()
37
 * @method   static void setPath($path)
38
 * @see      View::setPath()
39
 * @method   static void setTemplate($file)
40
 * @see      View::setTemplate()
41
 *
42
 * @method   static void set($key, $value)
43
 * @see      RegularAccess::set()
44
 * @method   static mixed get($key)
45
 * @see      RegularAccess::get()
46
 * @method   static bool contains($key)
47
 * @see      RegularAccess::contains()
48
 * @method   static void delete($key)
49
 * @see      RegularAccess::delete()
50
 *
51
 * @method   static string ahref(string $text, mixed $href, array $attributes = [])
52
 * @method   static array|null breadCrumbs(array $data = [])
53
 * @method   static string|null headScript(string $script = null)
54
 * @method   static string|null headStyle(string $style = null, $media = 'all')
55
 * @method   static string|null link(string $src = null, string $rel = 'stylesheet')
56
 * @method   static string|null meta(string $name = null, string $content = null)
57
 * @method   static string|null title(string $title = null, $position = 'replace', $separator = ' :: ')
58
 */
59
class Layout
60
{
61
    use ProxyTrait;
62
63
    /**
64
     * Constants for define positions
65
     */
66
    const POS_PREPEND = Instance::POS_PREPEND;
67
    const POS_REPLACE = Instance::POS_REPLACE;
68
    const POS_APPEND = Instance::POS_APPEND;
69
70
    /**
71
     * Init instance
72
     *
73
     * @return Instance
74
     */
75 6
    protected static function initInstance()
76
    {
77 6
        $instance = new Instance();
78 6
        $instance->setOptions(Config::getData('layout'));
79
        return $instance;
80
    }
81
}
82