Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
160 lines (143 loc) · 4.85 KB

File metadata and controls

160 lines (143 loc) · 4.85 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* phpDocumentor
*
* PHP Version 5
*
* @author Mike van Riel <mike.vanriel@naenius.com>
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor;
use \Symfony\Component\Console\Input\InputInterface;
require_once __DIR__ . '/../../vendor/autoload.php';
/**
* Application class for phpDocumentor.
*
* Can be used as bootstrap when the run method is not invoked.
*
* @author Mike van Riel <mike.vanriel@naenius.com>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class Application extends \Cilex\Application
{
const VERSION = '2.0.0a7';
/**
* Initializes all components used by phpDocumentor.
*/
function __construct()
{
parent::__construct('phpDocumentor', self::VERSION);
$this->addAutoloader();
$this->addLogging();
$this->addConfiguration();
$this->addEventDispatcher();
$this->loadPlugins();
$this['console']->getHelperSet()->set(
new \phpDocumentor\Console\Helper\ProgressHelper()
);
$this->addCommandsForProjectNamespace();
}
/**
* Run the application and if no command is provided, use project:run.
*
* @param bool $interactive Whether to run in interactive mode.
*
* @return void
*/
public function run($interactive = false)
{
$app = $this['console'];
if ($interactive) {
$app = new \Symfony\Component\Console\Shell($app);
}
$app->run(new \phpDocumentor\Console\Input\ArgvInput());
}
protected function addCommandsForProjectNamespace()
{
$this->command(new \phpDocumentor\Command\Project\ParseCommand());
$this->command(new \phpDocumentor\Command\Project\RunCommand());
$this->command(new \phpDocumentor\Command\Project\TransformCommand());
$this->command(new \phpDocumentor\Command\Plugin\GenerateCommand());
$this->command(new \phpDocumentor\Command\Template\GenerateCommand());
$this->command(new \phpDocumentor\Command\Template\ListCommand());
$this->command(new \phpDocumentor\Command\Template\PackageCommand());
}
protected function addAutoloader()
{
$this['autoloader'] = include __DIR__
. '/../../vendor/autoload.php';
}
protected function addLogging()
{
$this->register(new \Cilex\Provider\MonologServiceProvider(), array(
'monolog.name' => 'phpDocumentor',
'monolog.logfile' => sys_get_temp_dir().'/phpdoc.log'
));
}
/**
* Adds the Configuration object to the DIC.
*
* phpDocumentor first loads the template config file (/data/phpdoc.tpl.xml)
* and then the phpdoc.dist.xml, or the phpdoc.xml if it exists but not both,
* from the current working directory.
*
* The user config file (either phpdox.dist.xml or phpdoc.xml) is merged
* with the template file.
*
* @return void
*/
protected function addConfiguration()
{
$this['config'] = $this->share(
function () {
$user_config_file = (file_exists('phpdoc.xml'))
? 'phpdoc.xml'
: 'phpdoc.dist.xml';
$config_files = array(__DIR__ . '/../../data/phpdoc.tpl.xml');
if (is_readable($user_config_file)) {
$config_files[] = $user_config_file;
}
return \Zend\Config\Factory::fromFiles($config_files, true);
}
);
}
protected function addEventDispatcher()
{
$this['event_dispatcher'] = $this->share(
function () {
return new \sfEventDispatcher();
}
);
$this->linkEventDispatcherToSuperclasses();
}
/**
* Temporary method to link the event dispatcher to all subelements.
*
* @todo A different way should be devised for the Event Dispatcher to be passed.
*
* @return void
*/
protected function linkEventDispatcherToSuperclasses()
{
\phpDocumentor\Reflection\ReflectionAbstract::$event_dispatcher
= \phpDocumentor\Parser\ParserAbstract::$event_dispatcher
= \phpDocumentor\Transformer\TransformerAbstract::$event_dispatcher
= $this['event_dispatcher'];
}
protected function loadPlugins()
{
$app = $this;
$this['plugin_manager'] = $this->share(
function () use ($app) {
$manager = new \phpDocumentor\Plugin\Manager(
$app['event_dispatcher'], $app['config'], $app['autoloader']
);
return $manager;
}
);
$this['plugin_manager']->loadFromConfiguration();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.