Adds a lazy property identified by the given name. The property
is lazy because it is not evaluated until asked for via __get().

@param  string   $name
@param  callable $factory
@param  bool     $memoize
@return $this
3107
public function addProperty($name, callable $factory, $memoize = false)
    {
        $this->properties[$name] = ['factory' => \Closure::bind($factory, $this, $this), 'memoize' => $memoize];

        return $this;
    }
1184934
public static function factory($prefix, $name = null)
    {
        $calledClass = get_called_class();

        /** @var \PhalconRest\Api\ApiCollection $collection */
        $collection = new $calledClass($prefix);

        if ($name) {
            $collection->name($name);
        }

        return $collection;
    }
114012
public function addFactory(string $key, string $factory): FactoryResolver
    {
        if (is_subclass_of($factory, ServiceFactoryInterface::class, true) === false) {
            throw new InvalidFactoryType($factory);
        }

        $this->factories[$key] = $factory;

        return $this;
    }
430083
protected function registerFactoryMethod($name, $classOrFactory)
    {
        $this
            ->define($name, function($config = []) use($classOrFactory) {
                $factory = is_object($classOrFactory) ? $classOrFactory : new $classOrFactory();

                return new Filesystem(
                    $factory->create([ $config ])
                );
            })
        ;
    }
1159996
public function addDelegator(string $name, $factory)
    {
        if (isset($this->services[$name]) && ! $this->allowOverride) {
            throw ContainerModificationsNotAllowedException::fromExistingService($name);
        }
        $factory = is_array($factory) ? $factory : [ $factory];
        if (isset($this->delegators[$name])) {
            $this->delegators[$name] = $factory + $this->delegators[$name];
        } else {
            $this->delegators[$name] = $factory;
        }
    }
273524
public function setAsRequired($name)
    {
        $provider = $this->importDependency($name);
        $lastRequired = null;

        try {
            foreach ($provider->getDependencies() as $dependencyName) {
                $lastRequired = $dependencyName;
                if (!$this->isRequired($dependencyName)) {
                    $this->setAsRequired($dependencyName);
                }
            }
        } catch (DependencyException $exception) {
            throw new DependencyException(
                $exception->getCode() === 1
                    ? 'Dependency not found: '.$lastRequired.' < '.$name
                    : $exception->getMessage().' < '.$name,
                2
            );
        }

        return $this;
    }
661608
static function factory($name = 'default') {
        $class = get_called_class();
        if (!isset(self::$instances[$class][$name])) {
            self::$instances[$class][$name] = new $class($name);
        }

        return self::$instances[$class][$name];
    }
427556
public function set($name, $service)
    {
        if (isset($this->registry[$name])) {
            unset($this->registry[$name]);
        }
        if (isset($this->instances[$name])) {
            unset($this->instances[$name]);
        }
        if (null === $service) {
            return $this;
        }
        if (! is_string($service)) {
            $this->instances[$name] = $service;

            return $this;
        }
        $this->registry[$name] = $service;

        return $this;
    }
1146322
public static function get($name) 
    {
        self::load();
        if (!array_key_exists($name, self::$_factories)) {
            return null;
        }
        return self::$_factories[$name];
    }
668826
public function addStorage($name, $storage)
    {

        $isClosure = $storage instanceof Closure;

        if ($name == self::DEFAULT_STORAGE) {
            $this->storage = $isClosure ? $storage($name) : $storage;
            $this->storages[$name] = $this->storage;
            return $this;
        }

        if ($isClosure) {
            $this->bindings[$name] = $storage;
            return $this;
        }

        $this->storages[$name] = $storage;

        return $this;
    }
100018
public function setFactory($factory)
    {
        if (is_string($factory) && strpos($factory, '::') !== false) {
            $factory = explode('::', $factory, 2);
        }

        $this->factory = $factory;

        return $this;
    }
772371
public function set($name, $value)
    {
        $this->stale = true;

        try {
            if ($value === null) {
                $this->model->where('name', '=', $name)->delete();
            } else {
                $this->model->updateOrCreate(compact('name'), compact('value'));
            }
        } catch (Exception $e) {
            throw new WriteException($e);
        }
    }
856711
protected function getCachedProperty($name, \Closure $factory)
    {
        $name = (string) $name;
        if (!array_key_exists($name, $this->gettersCache)) {
            $this->gettersCache[$name] = call_user_func($factory);
        }

        return $this->gettersCache[$name];
    }
637587
public function remove($name) {
		if (substr($name, -1) === '_') {
			throw new InvalidArgumentException('$name cannot end with "_"');
		}
		unset($this->{$name});
		unset($this->factories_[$name]);
		return $this;
	}
1229549
public function createCache($name): Cache
    {
        if (!$this->cacheExists($name)) {
            $this->ensureCacheDir();
            /** @var Cache $cache */
            $cache = $this->app->make(Cache::class);
            $cache->setName($name);
            $cache->createCacheDir();
            $this->caches[$name] = $cache;
        }

        return $this->caches[$name];
    }
597142
public function setFormat($name)
    {
        if (!$this->hasFactory($name)) {
            throw new \InvalidArgumentException(sprintf(
                    'Invalid Canvas Factory "%s"', $name
            ));
        }
        $this->activeFactoryName = $name;
        $this->activeCanvas = $this->getFactory($name)->getCanvas();

        return $this;
    }
910538
function(name) {
			var args = [].slice.call(arguments, 1);
			var factory = this.get(name);
			return factory ? factory.apply(this, args) : null;
		}