forked from modstart/ModStartBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellApplication.php
More file actions
43 lines (31 loc) · 1.11 KB
/
Copy pathShellApplication.php
File metadata and controls
43 lines (31 loc) · 1.11 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
<?php
namespace Module\Vendor\Shell;
use Illuminate\Console\Application;
use Illuminate\Events\Dispatcher;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ShellApplication extends Application
{
public function __construct($name = 'Console Application', $version = '1.0.0')
{
parent::__construct($laravel = new \Illuminate\Foundation\Application(), new Dispatcher($laravel), $version);
$this->setName($name);
$this->setAutoExit(true);
$this->setCatchExceptions(true);
}
public function command($signature, \Closure $callback, $description = null)
{
return $this->add(
(new ClosureCommand($signature, $callback))->describe($description)
);
}
public function runAsSingle(InputInterface $input = null, OutputInterface $output = null)
{
foreach ($this->all() as $command) {
$this->setDefaultCommand($command, true);
break;
}
return $this->run($input, $output);
}
}