1 | <?php |
||
40 | class ApplicationFactory { |
||
41 | |||
42 | /** |
||
43 | * @var ApplicationFactory $instance |
||
44 | */ |
||
45 | private static $instance = null; |
||
46 | |||
47 | /** |
||
48 | * Holds the application singletons |
||
49 | * |
||
50 | * @var array $applicationStore |
||
51 | */ |
||
52 | private $applicationStore; |
||
53 | |||
54 | /** |
||
55 | * Library, that tells the ApplicationFactory, which class to use to instantiate which application |
||
56 | * |
||
57 | * @var array $applicationClassRegister |
||
58 | */ |
||
59 | private $applicationClassRegister; |
||
60 | |||
61 | /** |
||
62 | * @var \Psr\Log\LoggerInterface $logger |
||
63 | */ |
||
64 | private $logger; |
||
65 | 20 | ||
66 | 20 | /** |
|
67 | 20 | * Returns the singleton instance |
|
68 | * |
||
69 | * @return ApplicationFactory |
||
70 | */ |
||
71 | public static function getInstance() { |
||
78 | |||
79 | /** |
||
80 | * ApplicationFactory constructor. |
||
81 | 18 | * |
|
82 | 18 | * Do not instantiate directly, but use {@see ApplicationFactory::getInstance} |
|
83 | 18 | * instead. |
|
84 | 18 | * |
|
85 | * @see ApplicationFactory::getInstance |
||
86 | */ |
||
87 | public function __construct() { |
||
92 | |||
93 | 18 | /** |
|
94 | 18 | * @param null|bool|array $componentWhiteList |
|
95 | * |
||
96 | * @throws MWException cascading {@see \BootstrapComponents\ApplicationFactory::getApplication} |
||
97 | * |
||
98 | * @return ComponentLibrary |
||
99 | */ |
||
100 | public function getComponentLibrary( $componentWhiteList = null ) { |
||
103 | |||
104 | 21 | /** |
|
105 | 21 | * @throws MWException cascading {@see \BootstrapComponents\ApplicationFactory::getApplication} |
|
106 | * |
||
107 | * @return NestingController |
||
108 | */ |
||
109 | public function getNestingController() { |
||
112 | |||
113 | /** |
||
114 | * @param string[] $validAttributes |
||
115 | * @param string[] $aliases |
||
116 | * |
||
117 | * @see AttributeManager::__construct |
||
118 | 7 | * |
|
119 | 7 | * @return AttributeManager |
|
120 | */ |
||
121 | public function getNewAttributeManager( $validAttributes, $aliases ) { |
||
124 | |||
125 | /** |
||
126 | * @param string $id |
||
127 | 21 | * @param string $trigger must be safe raw html (best run through {@see Parser::recursiveTagParse}) |
|
128 | 21 | * @param string $content must be safe raw html (best run through {@see Parser::recursiveTagParse}) |
|
129 | * @param ParserOutputHelper $parserOutputHelper |
||
130 | * |
||
131 | * @see ModalBuilder::__construct |
||
132 | * |
||
133 | * @return ModalBuilder |
||
134 | */ |
||
135 | public function getNewModalBuilder( $id, $trigger, $content, $parserOutputHelper ) { |
||
138 | |||
139 | /** |
||
140 | * @param array $argumentsPassedByParser |
||
141 | * @param bool $isParserFunction |
||
142 | 24 | * @param string $componentName |
|
143 | 24 | * |
|
144 | * @see ParserRequest::__construct |
||
145 | * |
||
146 | * @throws \MWException cascading {@see ParserRequest::__construct} |
||
147 | * |
||
148 | * @return ParserRequest |
||
149 | */ |
||
150 | public function getNewParserRequest( $argumentsPassedByParser, $isParserFunction, $componentName = 'unknown' ) { |
||
153 | |||
154 | /** |
||
155 | 22 | * @param \Parser $parser |
|
156 | 22 | * |
|
157 | 21 | * @see ParserOutputHelper |
|
158 | 21 | * |
|
159 | 22 | * @throws MWException cascading {@see \BootstrapComponents\ApplicationFactory::getApplication} |
|
160 | * |
||
161 | * @return ParserOutputHelper |
||
162 | */ |
||
163 | public function getParserOutputHelper( $parser = null ) { |
||
169 | |||
170 | /** |
||
171 | * Registers an application with the ApplicationFactory. |
||
172 | 3 | * |
|
173 | 3 | * @param string $name |
|
174 | 3 | * @param string $class |
|
175 | 3 | * |
|
176 | 1 | * @throws MWException when class to register does not exist |
|
177 | 1 | * |
|
178 | 2 | * @return bool |
|
179 | 1 | */ |
|
180 | public function registerApplication( $name, $class ) { |
||
192 | |||
193 | /** |
||
194 | * Resets the application $application (or all, if $application is null), so that the next call to |
||
195 | * {@see ApplicationFactory::getApplication} will create a new object. |
||
196 | 24 | * |
|
197 | 24 | * @param null|string $application |
|
198 | 1 | * |
|
199 | 1 | * @return bool |
|
200 | 24 | */ |
|
201 | 23 | public function resetLookup( $application = null ) { |
|
211 | |||
212 | /** |
||
213 | * This returns the application $name. Creates a new instance and stores the singleton, if not already in store. |
||
214 | * You can supply any number of additional arguments to this function, they will be passed to the constructor. |
||
215 | * |
||
216 | * @param string $name |
||
217 | 24 | * |
|
218 | 24 | * @throws MWException when no class is registered for the requested application or the creation of the object fails. |
|
219 | 23 | * |
|
220 | * @return mixed|object |
||
221 | 24 | */ |
|
222 | protected function getApplication( $name ) { |
||
240 | |||
241 | 18 | /** |
|
242 | 18 | * @return array |
|
243 | 18 | */ |
|
244 | 18 | protected function getApplicationClassRegister() { |
|
251 | |||
252 | /** |
||
253 | * @return \Psr\Log\LoggerInterface |
||
254 | */ |
||
255 | protected function getLogger() { |
||
261 | } |
||
262 |