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
54
<?php
/**
* @link http://github.com/zfcampus/zf-development-mode for the canonical source repository
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ZF\DevelopmentMode;
class Command
{
/**
* Handle the CLI arguments.
*
* @param array $arguments
* @return int
*/
public function __invoke(array $arguments)
{
$help = new Help();
// Called without arguments
if (count($arguments) < 1) {
fwrite(STDERR, 'No arguments provided.' . PHP_EOL . PHP_EOL);
$help(STDERR);
return 1;
}
$argument = array_shift($arguments);
switch ($argument) {
case '-h':
case '--help':
$help();
return 0;
case 'disable':
$disable = new Disable();
return $disable();
case 'enable':
$enable = new Enable();
return $enable();
case 'status':
$status = new Status();
return $status();
case 'auto-composer':
$auto = new AutoComposer();
return $auto();
default:
fwrite(STDERR, 'Unrecognized argument.' . PHP_EOL . PHP_EOL);
$help(STDERR);
return 1;
}
}
}