Nextrek
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
|
<?php
namespace ClassPreloader;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Console\Application as BaseApplication;
/**
* ClassPreloader application CLI
*/
class Application extends BaseApplication
{
public function __construct()
{
parent::__construct('ClassPreloader');
// Create a finder to find each non-abstract command in the filesystem
$finder = new Finder();
$finder->files()
->in(__DIR__ . '/Command')
->notName('Abstract*')
->name('*.php');
// Add each command to the CLI
foreach ($finder as $file) {
$filename = str_replace('\\', '/', $file->getRealpath());
$pos = strrpos($filename, '/ClassPreloader/') + strlen('/ClassPreloader/');
$class = __NAMESPACE__ . '\\'
. substr(str_replace('/', '\\', substr($filename, $pos)), 0, -4);
$this->add(new $class());
}
}
}
|
Revision |
Author |
Commited |
Message |
1464
|
MOliva
|
Tue 13 Oct, 2020 11:16:56 +0000 |
|