FeaturedFlagsModel::getParamsArray()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
3
namespace FeaturedFlags;
4
5
class FeaturedFlagsModel
6
{
7
    protected $_status;
8
    protected $_data;
9
    protected $_endDate;
10
11 24
    public function __construct($status, $data = array(), $endDate = null)
12
    {
13 24
        $this->_status = $status;
14 24
        $this->_data = $data;
15 24
        $this->_endDate = $endDate;
16 24
    }
17
18
    /**
19
     * @return array
20
     */
21 7
    public function getParamsArray()
22
    {
23 7
        if (is_string($this->_data)) {
24 4
            return json_decode($this->_data, true);
25
        } else {
26 3
            return array();
27
        }
28
    }
29
30 17
    public function isEnabled()
31
    {
32 17
        return $this->_status == true;
33
    }
34
35
36 21
    public function getEndDate()
37
    {
38 21
        return $this->_endDate;
39
    }
40
}
41