Option::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace hemio\html;
4
5
/**
6
 * The <code>option</code> element represents an option in a select control, or an option
7
  in a labelled set of options grouped together in an optgroup, or an option
8
  among the list of suggestions in a datalist.
9
 *
10
 * @since version 1.0
11
 * @url http://www.w3.org/TR/html5/forms.html#the-option-element
12
 */
13
class Option extends Abstract_\ElementContent implements Interface_\ContentModelSelect
14
{
15
16
    public static function tagName()
17
    {
18
        return 'option';
19
    }
20
21
    /**
22
     *
23
     * @param string $strValue
24
     * @param Interface_\ContentModelText $objText
25
     */
26
    function __construct($strValue, Interface_\ContentModelText $objText)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
    {
28
        $this->setAttribute('value', $strValue);
29
        $this->addChild($objText);
30
    }
31
32
    public function isValidChild(Interface_\HtmlCode $child)
33
    {
34
        return $child instanceof Interface_\ContentModelText;
35
    }
36
37
    /**
38
     *
39
     * @param Interface_\ContentModelText $string
40
     * @return Interface_\ContentModelText
41
     */
42
    public function addChild(Interface_\ContentModelText $string)
43
    {
44
        $this->addChildInternal($string);
45
        return $string;
46
    }
47
}
48