3 * @copyright Copyright (C) 2020, Friendica
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 use Psr\Log\LoggerInterface;
28 * This class is capable of getting all dynamic created classes
30 * @see https://designpatternsphp.readthedocs.io/en/latest/Structural/Registry/README.html
37 public static function init(Dice $dice)
49 public static function app()
51 return self::$dice->create(App::class);
55 * @return Database\Database
57 public static function dba()
59 return self::$dice->create(Database\Database::class);
63 // "App" namespace instances
67 * @return App\Arguments
69 public static function args()
71 return self::$dice->create(App\Arguments::class);
77 public static function baseUrl()
79 return self::$dice->create(App\BaseURL::class);
85 public static function mode()
87 return self::$dice->create(App\Mode::class);
93 public static function module()
95 return self::$dice->create(App\Module::class);
101 public static function page()
103 return self::$dice->create(App\Page::class);
109 public static function router()
111 return self::$dice->create(App\Router::class);
115 // "Content" namespace instances
119 * @return Content\Item
121 public static function contentItem()
123 return self::$dice->create(Content\Item::class);
127 * @return Content\Text\BBCode\Video
129 public static function bbCodeVideo()
131 return self::$dice->create(Content\Text\BBCode\Video::class);
135 // "Core" namespace instances
139 * @return Core\Cache\ICache
141 public static function cache()
143 return self::$dice->create(Core\Cache\ICache::class);
147 * @return Core\Config\IConfig
149 public static function config()
151 return self::$dice->create(Core\Config\IConfig::class);
155 * @return Core\PConfig\IPConfig
157 public static function pConfig()
159 return self::$dice->create(Core\PConfig\IPConfig::class);
163 * @return Core\Lock\ILock
165 public static function lock()
167 return self::$dice->create(Core\Lock\ILock::class);
173 public static function l10n()
175 return self::$dice->create(Core\L10n::class);
179 * @return Core\Process
181 public static function process()
183 return self::$dice->create(Core\Process::class);
187 * @return Core\Session\ISession
189 public static function session()
191 return self::$dice->create(Core\Session\ISession::class);
195 * @return Core\StorageManager
197 public static function storageManager()
199 return self::$dice->create(Core\StorageManager::class);
203 // "LoggerInterface" instances
207 * @return LoggerInterface
209 public static function logger()
211 return self::$dice->create(LoggerInterface::class);
215 * @return LoggerInterface
217 public static function devLogger()
219 return self::$dice->create('$devLogger');
223 * @return LoggerInterface
225 public static function workerLogger()
227 return self::$dice->create(Util\Logger\WorkerLogger::class);
231 // "Factory" namespace instances
235 * @return Factory\Api\Mastodon\Account
237 public static function mstdnAccount()
239 return self::$dice->create(Factory\Api\Mastodon\Account::class);
243 * @return Factory\Api\Mastodon\Emoji
245 public static function mstdnEmoji()
247 return self::$dice->create(Factory\Api\Mastodon\Emoji::class);
251 * @return Factory\Api\Mastodon\Field
253 public static function mstdnField()
255 return self::$dice->create(Factory\Api\Mastodon\Field::class);
259 * @return Factory\Api\Mastodon\FollowRequest
261 public static function mstdnFollowRequest()
263 return self::$dice->create(Factory\Api\Mastodon\FollowRequest::class);
267 * @return Factory\Api\Mastodon\Relationship
269 public static function mstdnRelationship()
271 return self::$dice->create(Factory\Api\Mastodon\Relationship::class);
275 * @return Factory\Api\Mastodon\Status
277 public static function mstdnStatus()
279 return self::$dice->create(Factory\Api\Mastodon\Status::class);
283 * @return Factory\Api\Twitter\User
285 public static function twitterUser()
287 return self::$dice->create(Factory\Api\Twitter\User::class);
291 * @return Factory\Notification\Notification
293 public static function notification()
295 return self::$dice->create(Factory\Notification\Notification::class);
299 * @return Factory\Notification\Introduction
301 public static function notificationIntro()
303 return self::$dice->create(Factory\Notification\Introduction::class);
307 // "Model" namespace instances
310 * @return Model\Process
312 public static function modelProcess()
314 return self::$dice->create(Model\Process::class);
318 * @return Model\User\Cookie
320 public static function cookie()
322 return self::$dice->create(Model\User\Cookie::class);
326 * @return Model\Storage\IStorage
328 public static function storage()
330 return self::$dice->create(Model\Storage\IStorage::class);
334 // "Network" namespace
338 * @return Network\IHTTPRequest
340 public static function httpRequest()
342 return self::$dice->create(Network\IHTTPRequest::class);
346 // "Repository" namespace
350 * @return Repository\FSuggest;
352 public static function fsuggest()
354 return self::$dice->create(Repository\FSuggest::class);
358 * @return Repository\Introduction
360 public static function intro()
362 return self::$dice->create(Repository\Introduction::class);
366 * @return Repository\PermissionSet
368 public static function permissionSet()
370 return self::$dice->create(Repository\PermissionSet::class);
374 * @return Repository\ProfileField
376 public static function profileField()
378 return self::$dice->create(Repository\ProfileField::class);
382 * @return Repository\Notify
384 public static function notify()
386 return self::$dice->create(Repository\Notify::class);
390 // "Protocol" namespace instances
394 * @return Protocol\Activity
396 public static function activity()
398 return self::$dice->create(Protocol\Activity::class);
402 // "Security" namespace instances
406 * @return \Friendica\Security\Authentication
408 public static function auth()
410 return self::$dice->create(Security\Authentication::class);
414 // "Util" namespace instances
418 * @return Util\ACLFormatter
420 public static function aclFormatter()
422 return self::$dice->create(Util\ACLFormatter::class);
428 public static function basePath()
430 return self::$dice->create('$basepath');
434 * @return Util\DateTimeFormat
436 public static function dtFormat()
438 return self::$dice->create(Util\DateTimeFormat::class);
442 * @return Util\FileSystem
444 public static function fs()
446 return self::$dice->create(Util\FileSystem::class);
450 * @return Util\Profiler
452 public static function profiler()
454 return self::$dice->create(Util\Profiler::class);
458 * @return Util\Emailer
460 public static function emailer()
462 return self::$dice->create(Util\Emailer::class);