3 * @copyright Copyright (C) 2010-2021, the Friendica project
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\Application
245 public static function mstdnApplication()
247 return self::$dice->create(Factory\Api\Mastodon\Application::class);
251 * @return Factory\Api\Mastodon\Attachment
253 public static function mstdnAttachment()
255 return self::$dice->create(Factory\Api\Mastodon\Attachment::class);
259 * @return Factory\Api\Mastodon\Card
261 public static function mstdnCard()
263 return self::$dice->create(Factory\Api\Mastodon\Card::class);
267 * @return Factory\Api\Mastodon\Conversation
269 public static function mstdnConversation()
271 return self::$dice->create(Factory\Api\Mastodon\Conversation::class);
275 * @return Factory\Api\Mastodon\Emoji
277 public static function mstdnEmoji()
279 return self::$dice->create(Factory\Api\Mastodon\Emoji::class);
283 * @return Factory\Api\Mastodon\Error
285 public static function mstdnError()
287 return self::$dice->create(Factory\Api\Mastodon\Error::class);
291 * @return Factory\Api\Mastodon\FollowRequest
293 public static function mstdnFollowRequest()
295 return self::$dice->create(Factory\Api\Mastodon\FollowRequest::class);
299 * @return Factory\Api\Mastodon\Relationship
301 public static function mstdnRelationship()
303 return self::$dice->create(Factory\Api\Mastodon\Relationship::class);
307 * @return Factory\Api\Mastodon\Status
309 public static function mstdnStatus()
311 return self::$dice->create(Factory\Api\Mastodon\Status::class);
315 * @return Factory\Api\Mastodon\ListEntity
317 public static function mstdnList()
319 return self::$dice->create(Factory\Api\Mastodon\ListEntity::class);
323 * @return Factory\Api\Mastodon\Notification
325 public static function mstdnNotification()
327 return self::$dice->create(Factory\Api\Mastodon\Notification::class);
331 * @return Factory\Api\Twitter\User
333 public static function twitterUser()
335 return self::$dice->create(Factory\Api\Twitter\User::class);
339 * @return Factory\Notification\Notification
341 public static function notification()
343 return self::$dice->create(Factory\Notification\Notification::class);
347 * @return Factory\Notification\Introduction
349 public static function notificationIntro()
351 return self::$dice->create(Factory\Notification\Introduction::class);
355 // "Model" namespace instances
358 * @return Model\Process
360 public static function modelProcess()
362 return self::$dice->create(Model\Process::class);
366 * @return Model\User\Cookie
368 public static function cookie()
370 return self::$dice->create(Model\User\Cookie::class);
374 * @return Model\Storage\IStorage
376 public static function storage()
378 return self::$dice->create(Model\Storage\IStorage::class);
382 // "Network" namespace
386 * @return Network\IHTTPRequest
388 public static function httpRequest()
390 return self::$dice->create(Network\IHTTPRequest::class);
394 // "Repository" namespace
398 * @return Repository\FSuggest;
400 public static function fsuggest()
402 return self::$dice->create(Repository\FSuggest::class);
406 * @return Repository\Introduction
408 public static function intro()
410 return self::$dice->create(Repository\Introduction::class);
414 * @return Repository\PermissionSet
416 public static function permissionSet()
418 return self::$dice->create(Repository\PermissionSet::class);
422 * @return Repository\ProfileField
424 public static function profileField()
426 return self::$dice->create(Repository\ProfileField::class);
430 * @return Repository\Notification
432 public static function notify()
434 return self::$dice->create(Repository\Notification::class);
438 // "Protocol" namespace instances
442 * @return Protocol\Activity
444 public static function activity()
446 return self::$dice->create(Protocol\Activity::class);
450 // "Security" namespace instances
454 * @return \Friendica\Security\Authentication
456 public static function auth()
458 return self::$dice->create(Security\Authentication::class);
462 // "Util" namespace instances
466 * @return Util\ACLFormatter
468 public static function aclFormatter()
470 return self::$dice->create(Util\ACLFormatter::class);
476 public static function basePath()
478 return self::$dice->create('$basepath');
482 * @return Util\DateTimeFormat
484 public static function dtFormat()
486 return self::$dice->create(Util\DateTimeFormat::class);
490 * @return Util\FileSystem
492 public static function fs()
494 return self::$dice->create(Util\FileSystem::class);
498 * @return Util\Profiler
500 public static function profiler()
502 return self::$dice->create(Util\Profiler::class);
506 * @return Util\Emailer
508 public static function emailer()
510 return self::$dice->create(Util\Emailer::class);