forked from phpDocumentor/phpDocumentor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpdoc
executable file
·44 lines (35 loc) · 1.48 KB
/
phpdoc
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
#!/usr/bin/env php
<?php
use phpDocumentor\AutoloaderLocator;
use phpDocumentor\Kernel;
use Doctrine\Common\Annotations\AnnotationRegistry;
use phpDocumentor\Console\Application;
use Symfony\Bundle\FrameworkBundle\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
set_time_limit(0);
require __DIR__ . '/../src/phpDocumentor/AutoloaderLocator.php';
$loader = AutoloaderLocator::autoload();
if (!class_exists(SymfonyApplication::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}
if (!isset($_SERVER['PHPDOC_ENV']) && !Kernel::isPhar()) {
if (!class_exists(Dotenv::class)) {
throw new RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}
$input = new ArgvInput();
$defaultEnv = 'prod';
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['PHPDOC_ENV'] ?? $defaultEnv);
$debug = ($_SERVER['PHPDOC_DEBUG'] ?? ('prod' !== $env && 'phar' !== $env)) && !$input->hasParameterOption(['--no-debug', '']);
if ($debug) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);