GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Meta   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 82
rs 10
c 0
b 0
f 0
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A import() 0 9 3
A createElement() 0 12 2
A offsetSet() 0 9 2
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Html\Dom\Lists;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Html\Document;
19
use O2System\Html\Dom\Element;
20
21
/**
22
 * Class Meta
23
 *
24
 * @package O2System\HTML\DOM\Lists
25
 */
26
class Meta extends \ArrayIterator
27
{
28
    /**
29
     * Meta::$ownerDocument
30
     *
31
     * @var \O2System\Html\Document
32
     */
33
    public $ownerDocument;
34
35
    // ------------------------------------------------------------------------
36
37
    /**
38
     * Meta::__construct
39
     *
40
     * @param \O2System\Html\Document $ownerDocument
41
     */
42
    public function __construct(Document $ownerDocument)
43
    {
44
        $this->ownerDocument =& $ownerDocument;
45
    }
46
47
    // ------------------------------------------------------------------------
48
49
    /**
50
     * Meta::import
51
     *
52
     * @param \O2System\Html\Dom\Lists\Meta $metaNodes
53
     *
54
     * @return $this
55
     */
56
    public function import(Meta $metaNodes)
57
    {
58
        if (is_array($metaNodes = $metaNodes->getArrayCopy())) {
0 ignored issues
show
introduced by
The condition is_array($metaNodes = $metaNodes->getArrayCopy()) is always true.
Loading history...
59
            foreach ($metaNodes as $name => $value) {
60
                $this->offsetSet($name, $value);
61
            }
62
        }
63
64
        return $this;
65
    }
66
67
    // ------------------------------------------------------------------------
68
69
    /**
70
     * Meta::offsetSet
71
     *
72
     * @param string $name
73
     * @param string $value
74
     */
75
    public function offsetSet($name, $value)
76
    {
77
        if ($value instanceof Element) {
0 ignored issues
show
introduced by
$value is never a sub-type of O2System\Html\Dom\Element.
Loading history...
78
            parent::offsetSet($name, $value);
79
        } else {
80
            $meta = $this->ownerDocument->createElement('meta');
81
            $meta->setAttribute($name, $value);
82
83
            parent::offsetSet($name, $meta);
0 ignored issues
show
Bug introduced by
$meta of type DOMElement is incompatible with the type string expected by parameter $newval of ArrayIterator::offsetSet(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

83
            parent::offsetSet($name, /** @scrutinizer ignore-type */ $meta);
Loading history...
84
        }
85
    }
86
87
    // ------------------------------------------------------------------------
88
89
    /**
90
     * Meta::createElement
91
     *
92
     * @param array $attributes
93
     *
94
     * @return \DOMElement
95
     */
96
    public function createElement(array $attributes)
97
    {
98
        $meta = $this->ownerDocument->createElement('meta');
99
100
        $name = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $name is dead and can be removed.
Loading history...
101
        foreach ($attributes as $key => $value) {
102
            $meta->setAttribute($key, $value);
103
        }
104
105
        $this[] = $meta;
106
107
        return $meta;
108
    }
109
}