File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/modules/forum/lib/internals/entityfabric.php
Back
<?php namespace Bitrix\Forum\Internals; use \Bitrix\Main; trait EntityFabric { protected static $repo = []; /** * @param int $id * @return static */ public static function getById($id) { if (!array_key_exists(__CLASS__, self::$repo)) { self::$repo[__CLASS__] = []; } $id = intval($id); if (!array_key_exists($id, self::$repo[__CLASS__])) { try { self::$repo[__CLASS__][$id] = new static($id); } catch (Main\ObjectNotFoundException $exception) { return null; } } return self::$repo[__CLASS__][$id]; } public function destroy() { if (array_key_exists(__CLASS__, self::$repo)) { foreach (self::$repo[__CLASS__] as $key => $object) { if ($object === $this) { unset(self::$repo[__CLASS__][$key]); // AddMessage2Log("Object: ".__CLASS__." $key were destroyed."); return; } } } } /** * @param static|int $object * @return static */ public static function getInstance($object) { if ($object instanceof static) { return $object; } return static::getById($object); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.27 |
proxy
|
phpinfo
|
Settings