Completed
Branch 09branch (740a7d)
by Anton
02:52
created

ConsoleConfig::defaultCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license MIT
6
 * @author  Anton Titov (Wolfy-J)
7
 */
8
9
namespace Spiral\Console\Configs;
10
11
use Spiral\Core\InjectableConfig;
12
13
/**
14
 * Console component configuration.
15
 */
16
class ConsoleConfig extends InjectableConfig
17
{
18
    /**
19
     * Configuration section.
20
     */
21
    const CONFIG = 'console';
22
23
    /**
24
     * @var array
25
     */
26
    protected $config = [
27
        'locateCommands'    => true,
28
        'commands'          => [],
29
        'updateSequence'    => [],
30
        'configureSequence' => []
31
    ];
32
33
    /**
34
     * Indication that ConsoleDispatcher must locate commands.
35
     *
36
     * @return bool
37
     */
38
    public function locateCommands(): bool
39
    {
40
        if (!array_key_exists('locateCommands', $this->config)) {
41
            //Legacy config support
42
            return true;
43
        }
44
45
        return $this->config['locateCommands'];
46
    }
47
48
    /**
49
     * User defined set of commands (to be used when auto-location is off).
50
     *
51
     * @return array
52
     */
53
    public function userCommands(): array
54
    {
55
        if (!array_key_exists('commands', $this->config)) {
56
            //Legacy config support
57
            return [];
58
        }
59
60
        return $this->config['commands'];
61
    }
62
63
    /**
64
     * Set of commands to be executed in "spiral:configure" command.
65
     *
66
     * @return array
67
     */
68
    public function configureSequence(): array
69
    {
70
        return $this->config['configureSequence'];
71
    }
72
73
    /**
74
     * Set of commands to be executed in "spiral:update" command.
75
     *
76
     * @return array
77
     */
78
    public function updateSequence(): array
79
    {
80
        return $this->config['updateSequence'];
81
    }
82
}