forked from ApiGen/ApiGen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apigen.php
50 lines (41 loc) · 1.33 KB
/
apigen.php
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
47
48
49
50
#!/usr/bin/env php
<?php
/**
* ApiGen 3.0dev - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
* Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)
*
* For the full copyright and license information, please view
* the file LICENSE.md that was distributed with this source code.
*/
namespace ApiGen;
use Nette\Diagnostics\Debugger;
// Check environment
try {
require 'ApiGen/Environment.php';
Environment::init();
} catch (\Exception $e) {
fputs(STDERR, $e->getMessage() . "\n");
exit(min(1, $e->getCode()));
}
// Init Nette debugger
Debugger::$strictMode = true;
Debugger::$onFatalError[] = function() {
echo "\nFor more information turn on the debug mode using the --debug option.\n";
};
Debugger::enable(Debugger::PRODUCTION, false);
// Parse console input
$parser = new ConsoleParser();
$arguments = $parser->parseArguments(array_slice($argv, 1));
// Build the DIC
$configurator = new Config\Configurator($arguments);
$context = $configurator->createContainer();
// Update debugger configuration if needed
if ($context->apigen->config->debug) {
Debugger::enable(Debugger::DEVELOPMENT, false);
Debugger::$onFatalError = array();
}
// Let's rock
$context->apigen->application->run();