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\Authentication
69 public static function auth()
71 return self::$dice->create(App\Authentication::class);
75 * @return App\Arguments
77 public static function args()
79 return self::$dice->create(App\Arguments::class);
85 public static function baseUrl()
87 return self::$dice->create(App\BaseURL::class);
93 public static function mode()
95 return self::$dice->create(App\Mode::class);
101 public static function module()
103 return self::$dice->create(App\Module::class);
109 public static function page()
111 return self::$dice->create(App\Page::class);
117 public static function router()
119 return self::$dice->create(App\Router::class);
123 // "Content" namespace instances
127 * @return Content\Item
129 public static function contentItem()
131 return self::$dice->create(Content\Item::class);
135 * @return Content\Text\BBCode\Video
137 public static function bbCodeVideo()
139 return self::$dice->create(Content\Text\BBCode\Video::class);
143 // "Core" namespace instances
147 * @return Core\Cache\ICache
149 public static function cache()
151 return self::$dice->create(Core\Cache\ICache::class);
155 * @return Core\Config\IConfig
157 public static function config()
159 return self::$dice->create(Core\Config\IConfig::class);
163 * @return Core\PConfig\IPConfig
165 public static function pConfig()
167 return self::$dice->create(Core\PConfig\IPConfig::class);
171 * @return Core\Lock\ILock
173 public static function lock()
175 return self::$dice->create(Core\Lock\ILock::class);
181 public static function l10n()
183 return self::$dice->create(Core\L10n::class);
187 * @return Core\Process
189 public static function process()
191 return self::$dice->create(Core\Process::class);
195 * @return Core\Session\ISession
197 public static function session()
199 return self::$dice->create(Core\Session\ISession::class);
203 * @return Core\StorageManager
205 public static function storageManager()
207 return self::$dice->create(Core\StorageManager::class);
211 // "LoggerInterface" instances
215 * @return LoggerInterface
217 public static function logger()
219 return self::$dice->create(LoggerInterface::class);
223 * @return LoggerInterface
225 public static function devLogger()
227 return self::$dice->create('$devLogger');
231 * @return LoggerInterface
233 public static function workerLogger()
235 return self::$dice->create(Util\Logger\WorkerLogger::class);
239 // "Factory" namespace instances
243 * @return Factory\Api\Mastodon\Account
245 public static function mstdnAccount()
247 return self::$dice->create(Factory\Api\Mastodon\Account::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\Field
261 public static function mstdnField()
263 return self::$dice->create(Factory\Api\Mastodon\Field::class);
267 * @return Factory\Api\Mastodon\FollowRequest
269 public static function mstdnFollowRequest()
271 return self::$dice->create(Factory\Api\Mastodon\FollowRequest::class);
275 * @return Factory\Api\Mastodon\Relationship
277 public static function mstdnRelationship()
279 return self::$dice->create(Factory\Api\Mastodon\Relationship::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
311 * @return Model\User\Cookie
313 public static function cookie()
315 return self::$dice->create(Model\User\Cookie::class);
319 * @return Model\Storage\IStorage
321 public static function storage()
323 return self::$dice->create(Model\Storage\IStorage::class);
327 // "Network" namespace
331 * @return Network\IHTTPRequest
333 public static function httpRequest()
335 return self::$dice->create(Network\IHTTPRequest::class);
339 // "Repository" namespace
343 * @return Repository\FSuggest;
345 public static function fsuggest()
347 return self::$dice->create(Repository\FSuggest::class);
351 * @return Repository\Introduction
353 public static function intro()
355 return self::$dice->create(Repository\Introduction::class);
359 * @return Repository\PermissionSet
361 public static function permissionSet()
363 return self::$dice->create(Repository\PermissionSet::class);
367 * @return Repository\ProfileField
369 public static function profileField()
371 return self::$dice->create(Repository\ProfileField::class);
375 * @return Repository\Notify
377 public static function notify()
379 return self::$dice->create(Repository\Notify::class);
383 // "Protocol" namespace instances
387 * @return Protocol\Activity
389 public static function activity()
391 return self::$dice->create(Protocol\Activity::class);
395 // "Util" namespace instances
399 * @return Util\ACLFormatter
401 public static function aclFormatter()
403 return self::$dice->create(Util\ACLFormatter::class);
409 public static function basePath()
411 return self::$dice->create('$basepath');
415 * @return Util\DateTimeFormat
417 public static function dtFormat()
419 return self::$dice->create(Util\DateTimeFormat::class);
423 * @return Util\FileSystem
425 public static function fs()
427 return self::$dice->create(Util\FileSystem::class);
431 * @return Util\Profiler
433 public static function profiler()
435 return self::$dice->create(Util\Profiler::class);
439 * @return Util\Emailer
441 public static function emailer()
443 return self::$dice->create(Util\Emailer::class);