Meta   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 5
lcom 2
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
A set() 0 4 1
A get() 0 8 2
1
<?php
2
3
/**
4
 * Meta
5
 * @copyright Copyright (c) 2011 - 2014 Aleksandr Torosh (http://wezoom.com.ua)
6
 * @author Aleksandr Torosh <[email protected]>
7
 */
8
9
namespace Application\Mvc\Helper;
10
11
class Meta extends \Phalcon\Mvc\User\Component
12
{
13
14
    private static $instance;
15
    private static $storage = [];
16
17
    public static function getInstance()
18
    {
19
        if (!self::$instance) {
20
            self::$instance = new Meta();
21
        }
22
        return self::$instance;
23
24
    }
25
26
    public function set($name, $content)
27
    {
28
        self::$storage[$name] = $content;
29
    }
30
31
    public function get($name)
32
    {
33
        if (array_key_exists($name, self::$storage)) {
34
            $content = self::$storage[$name];
35
            $escaper = new \Phalcon\Escaper();
36
            return "<meta name=\"{$name}\" content=\"{$escaper->escapeHtml($content)}\">\n";
37
        }
38
    }
39
40
}
41