Passed
Push — 2.0-dev ( 26a24f...016e30 )
by Takehiro
02:41
created

Column::delete()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
namespace Kwkm\MkLiveStatusClient;
3
4
/**
5
 * Class Column
6
 *
7
 * @package Kwkm\MkLiveStatusClient
8
 * @author Takehiro Kawakami <[email protected]>
9
 * @license MIT
10
 */
11
class Column
12
{
13
    private $columns;
14
15 33
    public function __construct($columns = array())
16
    {
17 33
        $this->columns = $columns;
18 33
    }
19
20 8
    public function add($column)
21
    {
22 8
        $this->columns[] = $column;
23
24 8
        return $this;
25
    }
26
27 1
    public function delete($column)
28
    {
29 1
        $index = array_search($column, $this->columns);
30 1
        if ($index !== null) {
31 1
            unset($this->columns[$index]);
32 1
        }
33
34 1
        return $this;
35
    }
36
37 24
    public function get()
38
    {
39 24
        return $this->columns;
40
    }
41
}