芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/chocholayucatan.gob.mx/libraries/vendor/joomla/di/src/ContainerResource.php
container = $container; $this->shared = ($mode & self::SHARE) === self::SHARE; $this->protected = ($mode & self::PROTECT) === self::PROTECT; if (\is_callable($value)) { $this->factory = $value; } else { if ($this->shared) { $this->instance = $value; } if (\is_object($value)) { $this->factory = function () use ($value) { return clone $value; }; } else { $this->factory = function () use ($value) { return $value; }; } } } /** * Check whether the resource is shared * * @return boolean * * @since 2.0.0 */ public function isShared(): bool { return $this->shared; } /** * Check whether the resource is protected * * @return boolean * * @since 2.0.0 */ public function isProtected(): bool { return $this->protected; } /** * Get an instance of the resource * * If a factory was provided, the resource is created and - if it is a shared resource - cached internally. * If the resource was provided directly, that resource is returned. * * @return mixed * * @since 2.0.0 */ public function getInstance() { $callable = $this->factory; if ($this->isShared()) { if ($this->instance === null) { $this->instance = $callable($this->container); } return $this->instance; } return $callable($this->container); } /** * Get the factory * * @return callable * * @since 2.0.0 */ public function getFactory(): callable { return $this->factory; } /** * Reset the resource * * The instance cache is cleared, so that the next call to get() returns a new instance. * This has an effect on shared, non-protected resources only. * * @return boolean True if the resource was reset, false otherwise * * @since 2.0.0 */ public function reset(): bool { if ($this->isShared() && !$this->isProtected()) { $this->instance = null; return true; } return false; } }