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