|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the Code-Insight library. |
|
4
|
|
|
* For the full copyright and license information, please view |
|
5
|
|
|
* the LICENSE file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright Alexander Obuhovich <[email protected]> |
|
8
|
|
|
* @link https://github.com/console-helpers/code-insight |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace ConsoleHelpers\CodeInsight; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
use ConsoleHelpers\CodeInsight\Command\BackwardsCompatibilityCommand; |
|
15
|
|
|
use ConsoleHelpers\CodeInsight\Command\CompletionCommand; |
|
16
|
|
|
use ConsoleHelpers\CodeInsight\Command\ReportCommand; |
|
17
|
|
|
use ConsoleHelpers\CodeInsight\Command\Dev\MigrationCreateCommand; |
|
18
|
|
|
use ConsoleHelpers\CodeInsight\Command\SyncCommand; |
|
19
|
|
|
use ConsoleHelpers\ConsoleKit\Application as BaseApplication; |
|
20
|
|
|
use ConsoleHelpers\CodeInsight\Command\MissingTestsCommand; |
|
21
|
|
|
use Symfony\Component\Console\Command\Command; |
|
22
|
|
|
|
|
23
|
|
|
class Application extends BaseApplication |
|
24
|
|
|
{ |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Initializes all the composer commands. |
|
28
|
|
|
* |
|
29
|
|
|
* @return Command[] An array of default Command instances. |
|
30
|
|
|
*/ |
|
31
|
|
|
protected function getDefaultCommands() |
|
32
|
|
|
{ |
|
33
|
|
|
$default_commands = parent::getDefaultCommands(); |
|
34
|
|
|
$default_commands[] = new MissingTestsCommand(); |
|
35
|
|
|
$default_commands[] = new SyncCommand(); |
|
36
|
|
|
$default_commands[] = new ReportCommand(); |
|
37
|
|
|
$default_commands[] = new BackwardsCompatibilityCommand(); |
|
38
|
|
|
$default_commands[] = new CompletionCommand(); |
|
39
|
|
|
|
|
40
|
|
|
if ( !$this->isPharFile() ) { |
|
41
|
|
|
$default_commands[] = new MigrationCreateCommand(); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
return $default_commands; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Detects, when we're inside PHAR file. |
|
49
|
|
|
* |
|
50
|
|
|
* @return boolean |
|
51
|
|
|
*/ |
|
52
|
|
|
protected function isPharFile() |
|
53
|
|
|
{ |
|
54
|
|
|
return strpos(__DIR__, 'phar://') === 0; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|