Options::initDefaultOptionItems()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 18
nc 1
nop 0
dl 0
loc 26
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright © 2017 Toan Nguyen. All rights reserved.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Gojira\Framework\App\Configuration;
10
11
use Gojira\Framework\Data\DataObject;
12
13
/**
14
 * Base class to work with option items
15
 *
16
 * @package Gojira\Framework\App\Configuration
17
 * @author  Toan Nguyen <[email protected]>
18
 */
19
class Options extends DataObject implements OptionsInterface
20
{
21
    /**
22
     * Overwrite data in the object.
23
     *
24
     * The $key parameter can be string or array.
25
     * If $key is string, the attribute value will be overwritten by $value
26
     *
27
     * If $key is an array, it will overwrite all the data in the object.
28
     *
29
     * @param string|array $key
30
     * @param mixed        $value
31
     *
32
     * @return $this
33
     */
34 View Code Duplication
    public function setData($key, $value = null)
35
    {
36
        if ($key === (array)$key) {
37
            $this->_data = $key;
38
        } else {
39
            $this->_data[$key] = $value;
40
        }
41
42
        return $this;
43
    }
44
45
    /**
46
     * Init default option items
47
     *
48
     * @return array
49
     */
50
    public function initDefaultOptionItems()
51
    {
52
        return [
53
            self::JIRA_STOP        => [
54
                self::STATUS => 'To Do'
55
            ],
56
            self::JIRA_START       => [
57
                self::STATUS => 'In Progress'
58
            ],
59
            self::JIRA_REVIEW      => [
60
                self::STATUS => 'In Review'
61
            ],
62
            self::JIRA_DONE        => [
63
                self::STATUS => 'Done'
64
            ],
65
            self::AVAILABLE_ISSUES => [
66
                'Open',
67
                'In Progress',
68
                'Reopened',
69
                'To Do',
70
                'In Review',
71
                'Blocked',
72
                'Internal Testing'
73
            ]
74
        ];
75
    }
76
}
77