Completed
Pull Request — master (#399)
by Anton
04:35
created

Layout   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 0
cts 6
cp 0
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 $src = null, array $attributes = [])
54
 * @method static string|null headScriptBlock(string $code = null)
55
 * @method static string|null headStyle(string $href = null, string $media = 'all')
56
 * @method static string|null link(string $src = null, string $rel = 'stylesheet')
57
 * @method static string|null meta(string $name = null, string $content = null)
58
 * @method static string|null title(string $title = null, $position = 'replace', $separator = ' :: ')
59
 */
60
class Layout
61
{
62
    use ProxyTrait;
63
64
    /**
65
     * Constants for define positions
66
     */
67
    const POS_PREPEND = Instance::POS_PREPEND;
68
    const POS_REPLACE = Instance::POS_REPLACE;
69
    const POS_APPEND = Instance::POS_APPEND;
70
71
    /**
72
     * Init instance
73
     *
74
     * @return Instance
75
     */
76
    protected static function initInstance()
77
    {
78
        $instance = new Instance();
79
        $instance->setOptions(Config::getData('layout'));
80
        return $instance;
81
    }
82
}
83