1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Recca0120\Terminal; |
4
|
|
|
|
5
|
|
|
use Illuminate\Contracts\Console\Kernel as KernelContract; |
6
|
|
|
use Illuminate\Support\Arr; |
7
|
|
|
use Recca0120\Terminal\Application as Artisan; |
8
|
|
|
|
9
|
|
|
class Kernel implements KernelContract |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* The Artisan application instance. |
13
|
|
|
* |
14
|
|
|
* @var \Illuminate\Console\Application |
15
|
|
|
*/ |
16
|
|
|
protected $app; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* $config. |
20
|
|
|
* |
21
|
|
|
* @var array |
22
|
|
|
*/ |
23
|
|
|
protected $config; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* The Artisan commands provided by the application. |
27
|
|
|
* |
28
|
|
|
* @var array |
29
|
|
|
*/ |
30
|
|
|
protected $commands = []; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Create a new console kernel instance. |
34
|
|
|
* |
35
|
|
|
* @param \Recca0120\Terminal\Application $app |
36
|
|
|
*/ |
37
|
7 |
|
public function __construct(Artisan $app, $config = []) |
38
|
|
|
{ |
39
|
7 |
|
$this->app = $app; |
40
|
7 |
|
$this->config = Arr::except(array_merge([ |
41
|
7 |
|
'username' => 'LARAVEL', |
42
|
7 |
|
'hostname' => php_uname('n'), |
43
|
7 |
|
'os' => PHP_OS, |
44
|
|
|
], $config), [ |
45
|
7 |
|
'enabled', |
46
|
|
|
'whitelists', |
47
|
|
|
'route', |
48
|
|
|
'commands', |
49
|
|
|
]); |
50
|
7 |
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* getConfig. |
54
|
|
|
* |
55
|
|
|
* @return array |
56
|
|
|
*/ |
57
|
|
|
public function getConfig() |
58
|
|
|
{ |
59
|
|
|
return $this->config; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Bootstrap the application for artisan commands. |
64
|
|
|
* |
65
|
|
|
* @return void |
66
|
|
|
*/ |
67
|
6 |
|
public function bootstrap() |
68
|
|
|
{ |
69
|
6 |
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Handle an incoming console command. |
73
|
|
|
* |
74
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
75
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
76
|
|
|
* @return int |
77
|
|
|
*/ |
78
|
1 |
|
public function handle($input, $output = null) |
79
|
|
|
{ |
80
|
1 |
|
$this->bootstrap(); |
81
|
|
|
|
82
|
1 |
|
return $this->app->run($input, $output); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Run an Artisan console command by name. |
87
|
|
|
* |
88
|
|
|
* @param string $command |
89
|
|
|
* @param array $parameters |
90
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $outputBuffer |
91
|
|
|
* @return int |
92
|
|
|
*/ |
93
|
1 |
|
public function call($command, array $parameters = [], $outputBuffer = null) |
94
|
|
|
{ |
95
|
1 |
|
$this->bootstrap(); |
96
|
|
|
|
97
|
1 |
|
return $this->app->call($command, $parameters, $outputBuffer); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Queue an Artisan console command by name. |
102
|
|
|
* |
103
|
|
|
* @param string $command |
104
|
|
|
* @param array $parameters |
105
|
|
|
* @return void |
106
|
|
|
*/ |
107
|
1 |
|
public function queue($command, array $parameters = []) |
108
|
|
|
{ |
109
|
1 |
|
$this->bootstrap(); |
110
|
1 |
|
$app = $this->app->getLaravel(); |
111
|
1 |
|
$app['Illuminate\Contracts\Queue\Queue']->push( |
112
|
1 |
|
'Illuminate\Foundation\Console\QueuedJob', func_get_args() |
113
|
|
|
); |
114
|
1 |
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Get all of the commands registered with the console. |
118
|
|
|
* |
119
|
|
|
* @return array |
120
|
|
|
*/ |
121
|
1 |
|
public function all() |
122
|
|
|
{ |
123
|
1 |
|
$this->bootstrap(); |
124
|
|
|
|
125
|
1 |
|
return $this->app->all(); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Get the output for the last run command. |
130
|
|
|
* |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
1 |
|
public function output() |
134
|
|
|
{ |
135
|
1 |
|
$this->bootstrap(); |
136
|
|
|
|
137
|
1 |
|
return $this->app->output(); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Terminate the application. |
142
|
|
|
* |
143
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
144
|
|
|
* @param int $status |
145
|
|
|
* @return void |
146
|
|
|
*/ |
147
|
1 |
|
public function terminate($input, $status) |
148
|
|
|
{ |
149
|
1 |
|
$this->bootstrap(); |
150
|
1 |
|
$this->app->terminate(); |
|
|
|
|
151
|
1 |
|
} |
152
|
|
|
} |
153
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.