Passed
Push — master ( d5adc1...45b033 )
by Fabio
06:12
created

PradoCommandLineActiveRecordGen   A

Complexity

Total Complexity 35

Size/Duplication

Total Lines 176
Duplicated Lines 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
eloc 83
c 2
b 2
f 0
dl 0
loc 176
rs 9.6
wmc 35
1
<?php
2
3
/**
4
 * Prado command line developer tools.
5
 *
6
 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
7
 * @link https://github.com/pradosoft/prado
8
 * @license https://github.com/pradosoft/prado/blob/master/LICENSE
9
 */
10
11
if (!isset($_SERVER['argv']) || php_sapi_name() !== 'cli') {
12
	die('Must be run from the command line');
13
}
14
15
// Locate composer's autoloader
16
if (file_exists($autoloader = realpath(__DIR__ . '/../vendor/autoload.php'))) {
17
	// if we are running inside a prado repo checkout, get out of bin/
18
	include($autoloader);
19
} elseif (file_exists($autoloader = realpath(__DIR__ . '/../../../autoload.php'))) {
20
	// if we are running from inside an application's vendor/ directory, get out of pradosoft/prado/bin/
21
	include($autoloader);
22
}
23
24
use Prado\Shell\TShellInterpreter;
25
26
use Prado\Shell\Actions\TActiveRecordGenAction;
27
use Prado\Shell\Actions\TActiveRecordGenAllAction;
28
use Prado\Shell\Actions\TAppAction;
29
use Prado\Shell\Actions\TFlushCachesAction;
30
use Prado\Shell\Actions\TPhpShellAction;
31
32
restore_exception_handler();
33
34
//register action classes
35
TShellInterpreter::getInstance()->addActionClass('Prado\\Shell\\Actions\\TAppAction');
36
TShellInterpreter::getInstance()->addActionClass('Prado\\Shell\\Actions\\TFlushCachesAction');
37
TShellInterpreter::getInstance()->addActionClass('Prado\\Shell\\Actions\\TPhpShellAction');
38
TShellInterpreter::getInstance()->addActionClass('Prado\\Shell\\Actions\\TActiveRecordGenAction');
39
TShellInterpreter::getInstance()->addActionClass('Prado\\Shell\\Actions\\TActiveRecordGenAllAction');
40
41
//run it;
42
TShellInterpreter::getInstance()->run($_SERVER['argv']);
43