1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author jan huang <[email protected]> |
4
|
|
|
* @copyright 2016 |
5
|
|
|
* |
6
|
|
|
* @see https://www.github.com/janhuang |
7
|
|
|
* @see http://www.fast-d.cn/ |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace FastD; |
11
|
|
|
|
12
|
|
|
use FastD\Console\ConfigDump; |
13
|
|
|
use FastD\Console\ControllerCreate; |
14
|
|
|
use FastD\Console\ModelCreate; |
15
|
|
|
use FastD\Console\RouteDump; |
16
|
|
|
use FastD\Console\SeedCreate; |
17
|
|
|
use FastD\Console\SeedRun; |
18
|
|
|
use Symfony\Component\Console\Application as Symfony; |
19
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
20
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
21
|
|
|
use Symfony\Component\Debug\Exception\FatalThrowableError; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Class AppConsole. |
25
|
|
|
*/ |
26
|
|
|
class Console extends Symfony |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* AppConsole constructor. |
30
|
|
|
* |
31
|
|
|
* @param Application $app |
32
|
|
|
*/ |
33
|
|
|
public function __construct(Application $app) |
34
|
|
|
{ |
35
|
|
|
parent::__construct($app->getName(), Application::VERSION); |
36
|
|
|
|
37
|
|
|
$this->addCommands([ |
38
|
|
|
new ModelCreate(), |
39
|
|
|
new ControllerCreate(), |
40
|
|
|
new RouteDump(), |
41
|
|
|
new ConfigDump(), |
42
|
|
|
new SeedCreate(), |
43
|
|
|
new SeedRun(), |
44
|
|
|
]); |
45
|
|
|
|
46
|
|
|
$this->registerCommands(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Scan commands. |
51
|
|
|
*/ |
52
|
|
|
public function registerCommands() |
53
|
|
|
{ |
54
|
|
|
foreach (config()->get('consoles', []) as $console) { |
55
|
|
|
$this->add(new $console()); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
if (false !== ($files = glob(app()->getPath().'/src/Console/*.php', GLOB_NOSORT | GLOB_NOESCAPE))) { |
59
|
|
|
foreach ($files as $file) { |
60
|
|
|
$command = '\\Console\\'.pathinfo($file, PATHINFO_FILENAME); |
61
|
|
|
$this->add(new $command()); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function doRun(InputInterface $input, OutputInterface $output) |
67
|
|
|
{ |
68
|
|
|
try { |
69
|
|
|
return parent::doRun($input, $output); |
70
|
|
|
} catch (\Exception $exception) { |
71
|
|
|
app()->handleException($exception); |
72
|
|
|
} catch (\Throwable $exception) { |
|
|
|
|
73
|
|
|
app()->handleException(new FatalThrowableError($exception)); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
throw $exception; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.