1 | <?php |
||
5 | class Command extends BaseDecorator |
||
6 | { |
||
7 | /** |
||
8 | * Commands that correspond to a color in the $colors property |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | public $commands = []; |
||
13 | |||
14 | /** |
||
15 | * The default commands available |
||
16 | * |
||
17 | * @var array $defaults |
||
18 | */ |
||
19 | protected $defaults = [ |
||
20 | 'info' => 'green', |
||
21 | 'comment' => 'yellow', |
||
22 | 'whisper' => 'light_gray', |
||
23 | 'shout' => 'red', |
||
24 | 'error' => 'light_red', |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * Add a command into the mix |
||
29 | * |
||
30 | * @param string $key |
||
31 | * @param mixed $value |
||
32 | */ |
||
33 | 948 | public function add($key, $value) |
|
37 | |||
38 | /** |
||
39 | * Retrieve all of the available commands |
||
40 | * |
||
41 | * @return array |
||
42 | */ |
||
43 | 580 | public function all() |
|
47 | |||
48 | /** |
||
49 | * Get the style that corresponds to the command |
||
50 | * |
||
51 | * @param string $val |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | 32 | public function get($val) |
|
63 | |||
64 | /** |
||
65 | * Set the currently used command |
||
66 | * |
||
67 | * @param string $val |
||
68 | * |
||
69 | * @return string|false |
||
70 | */ |
||
71 | 24 | public function set($val) |
|
77 | } |
||
78 |