-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
composer-unused
executable file
·46 lines (36 loc) · 1.34 KB
/
composer-unused
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
44
45
46
#!/usr/bin/env php
<?php
use Icanhazstring\Composer\Unused\Console\Command\UnusedCommand;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
(static function ($argv) {
foreach (
[
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../../vendor/autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php'
] as $file) {
if (file_exists($file)) {
define('UNUSED_COMPOSER_INSTALL', $file);
break;
}
}
if (!defined('UNUSED_COMPOSER_INSTALL')) {
fwrite(
STDERR,
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
' composer install' . PHP_EOL . PHP_EOL .
'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
);
die(1);
}
require UNUSED_COMPOSER_INSTALL;
/** @var ContainerInterface $container */
$container = require __DIR__ . '/../config/container.php';
$application = new Application('composer-unused', UnusedCommand::VERSION);
$application->add($container->get(UnusedCommand::class));
$application->setDefaultCommand('unused', true);
$application->run(new ArgvInput($argv));
})($argv);