-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole_command.php
More file actions
53 lines (39 loc) · 1.23 KB
/
console_command.php
File metadata and controls
53 lines (39 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
class EXT_Console_Command
{
//--------------------------------------------------------------------------
protected $key = '';
public $description = '';
public $commands = '';
//--------------------------------------------------------------------------
public function __construct($command)
{
$this->console =& $command->console;
}
//--------------------------------------------------------------------------
public function key($key = NULL, $description = NULL)
{
if ($key)
{
$this->key = $key;
if ($description) $this->description = $description;
}
return $this->key;
}
//--------------------------------------------------------------------------
public function command($cmd, $cmd_description)
{
$this->commands[$cmd] = array(
'description' => $cmd_description,
'arguments' => array(),
'required' => array()
);
}
//--------------------------------------------------------------------------
public function add_argument($cmd, $arg, $arg_description, $requiered = FALSE)
{
$this->commands[$cmd]['arguments'][$arg] = $arg_description;
$this->commands[$cmd]['required'][$arg] = (bool)$requiered;
}
//--------------------------------------------------------------------------
}