Checkbox   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 1
cbo 1
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 4 1
A click() 0 8 2
A getValue() 0 4 1
1
<?php
2
3
namespace SP\Crawler\Element;
4
5
/**
6
 * @author    Ivan Kerin <[email protected]>
7
 * @copyright 2015, Clippings Ltd.
8
 * @license   http://spdx.org/licenses/BSD-3-Clause
9
 */
10
class Checkbox extends AbstractElement implements ClickableInterface, InputInterface
11
{
12
    /**
13
     * @param boolean $value
14
     */
15 2
    public function setValue($value)
16
    {
17 2
        $this->setAttribute('value', $value);
18 2
    }
19
20 1
    public function click()
21
    {
22 1
        if ($this->hasAttribute('checked')) {
23 1
            $this->removeAttribute('checked');
24 1
        } else {
25 1
            $this->setAttribute('checked', 'checked');
26
        }
27 1
    }
28
29
    /**
30
     * @return string
31
     */
32 4
    public function getValue()
33
    {
34 4
        return $this->getAttribute('value');
35
    }
36
}
37