Completed
Pull Request — master (#600)
by Greg
03:17
created

Config::setDecorated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Robo\Config;
3
4
class Config extends \Consolidation\Config\Config
5
{
6
    const PROGRESS_BAR_AUTO_DISPLAY_INTERVAL = 'progress-delay';
7
    const DEFAULT_PROGRESS_DELAY = 2;
8
    const SIMULATE = 'simulate';
9
    const INTERACTIVE = 'interactive';
10
    const DECORATED = 'decorated';
11
12
    /**
13
     * Create a new configuration object, and initialize it with
14
     * the provided nested array containing configuration data.
15
     */
16
    public function __construct(array $data = null)
17
    {
18
        parent::__construct($data);
19
        $this->defaults = $this->getGlobalOptionDefaultValues();
20
    }
21
22
    /**
23
     * Return an associative array containing all of the global configuration
24
     * options and their default values.
25
     *
26
     * @return array
27
     */
28
    public function getGlobalOptionDefaultValues()
29
    {
30
        $globalOptions =
31
        [
32
            self::PROGRESS_BAR_AUTO_DISPLAY_INTERVAL => self::DEFAULT_PROGRESS_DELAY,
33
            self::SIMULATE => false,
34
        ];
35
36
        return $globalOptions;
37
    }
38
39
    /**
40
     * @return bool
41
     */
42
    public function isSimulated()
43
    {
44
        return $this->get(self::SIMULATE);
45
    }
46
47
    /**
48
     * @param bool $simulated
49
     *
50
     * @return $this
51
     */
52
    public function setSimulated($simulated = true)
53
    {
54
        return $this->set(self::SIMULATE, $simulated);
55
    }
56
57
    /**
58
     * @return bool
59
     */
60
    public function isInteractive()
61
    {
62
        return $this->get(self::INTERACTIVE);
63
    }
64
65
    /**
66
     * @param bool $simulated
0 ignored issues
show
Bug introduced by
There is no parameter named $simulated. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
67
     *
68
     * @return $this
69
     */
70
    public function setInteractive($interactive = true)
71
    {
72
        return $this->set(self::INTERACTIVE, $interactive);
73
    }
74
75
    /**
76
     * @return bool
77
     */
78
    public function isDecorated()
79
    {
80
        return $this->get(self::DECORATED);
81
    }
82
83
    /**
84
     * @param bool $decorated
85
     *
86
     * @return $this
87
     */
88
    public function setDecorated($decorated = true)
89
    {
90
        return $this->set(self::DECORATED, $decorated);
91
    }
92
93
    /**
94
     * @param int $interval
95
     *
96
     * @return $this
97
     */
98
    public function setProgressBarAutoDisplayInterval($interval)
99
    {
100
        return $this->set(self::PROGRESS_BAR_AUTO_DISPLAY_INTERVAL, $interval);
101
    }
102
}
103