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\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\Mention
301 public static function mstdnMention()
303 return self::$dice->create(Factory\Api\Mastodon\Mention::class);
307 * @return Factory\Api\Mastodon\Tag
309 public static function mstdnTag()
311 return self::$dice->create(Factory\Api\Mastodon\Tag::class);
315 * @return Factory\Api\Twitter\User
317 public static function twitterUser()
319 return self::$dice->create(Factory\Api\Twitter\User::class);
323 * @return Factory\Notification\Notification
325 public static function notification()
327 return self::$dice->create(Factory\Notification\Notification::class);
331 * @return Factory\Notification\Introduction
333 public static function notificationIntro()
335 return self::$dice->create(Factory\Notification\Introduction::class);
339 // "Model" namespace instances
342 * @return Model\Process
344 public static function modelProcess()
346 return self::$dice->create(Model\Process::class);
350 * @return Model\User\Cookie
352 public static function cookie()
354 return self::$dice->create(Model\User\Cookie::class);
358 * @return Model\Storage\IStorage
360 public static function storage()
362 return self::$dice->create(Model\Storage\IStorage::class);
366 // "Network" namespace
370 * @return Network\IHTTPRequest
372 public static function httpRequest()
374 return self::$dice->create(Network\IHTTPRequest::class);
378 // "Repository" namespace
382 * @return Repository\FSuggest;
384 public static function fsuggest()
386 return self::$dice->create(Repository\FSuggest::class);
390 * @return Repository\Introduction
392 public static function intro()
394 return self::$dice->create(Repository\Introduction::class);
398 * @return Repository\PermissionSet
400 public static function permissionSet()
402 return self::$dice->create(Repository\PermissionSet::class);
406 * @return Repository\ProfileField
408 public static function profileField()
410 return self::$dice->create(Repository\ProfileField::class);
414 * @return Repository\Notify
416 public static function notify()
418 return self::$dice->create(Repository\Notify::class);
422 // "Protocol" namespace instances
426 * @return Protocol\Activity
428 public static function activity()
430 return self::$dice->create(Protocol\Activity::class);
434 // "Security" namespace instances
438 * @return \Friendica\Security\Authentication
440 public static function auth()
442 return self::$dice->create(Security\Authentication::class);
446 // "Util" namespace instances
450 * @return Util\ACLFormatter
452 public static function aclFormatter()
454 return self::$dice->create(Util\ACLFormatter::class);
460 public static function basePath()
462 return self::$dice->create('$basepath');
466 * @return Util\DateTimeFormat
468 public static function dtFormat()
470 return self::$dice->create(Util\DateTimeFormat::class);
474 * @return Util\FileSystem
476 public static function fs()
478 return self::$dice->create(Util\FileSystem::class);
482 * @return Util\Profiler
484 public static function profiler()
486 return self::$dice->create(Util\Profiler::class);
490 * @return Util\Emailer
492 public static function emailer()
494 return self::$dice->create(Util\Emailer::class);