FOF30\Pimple\Container::factory PHP Method

factory() public method

Marks a callable as being a factory service.
public factory ( callable $callable ) : callable
$callable callable A service definition to be used as a factory
return callable The passed callable
    public function factory($callable)
    {
        if (!is_object($callable) || !method_exists($callable, '__invoke')) {
            throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.');
        }
        $this->factories->attach($callable);
        return $callable;
    }