-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconsole
More file actions
24 lines (19 loc) · 776 Bytes
/
console
File metadata and controls
24 lines (19 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env php
<?php
require 'vendor/autoload.php';
$application = new Symfony\Component\Console\Application();
// List all available commands
$iterator = new \DirectoryIterator(__DIR__ . '/src/EloGank/Api/Command');
/** @var \SplFileInfo $command */
foreach ($iterator as $command) {
if ($command->isDir()) {
continue;
}
$name = substr($command->getFilename(), 0, -4);
$reflectionClass = new \ReflectionClass('\\EloGank\\Api\\Command\\' . $name);
if ($reflectionClass->isSubclassOf('\\EloGank\\Api\\Component\\Command\\Command') || $reflectionClass->isSubclassOf('Symfony\\Component\\Console\\Command\\Command')) {
$class = '\\EloGank\\Api\\Command\\' . $name;
$application->add(new $class());
}
}
$application->run();