src/Box/Box.php
public function factory($name, $definition)
    {
        if (!is_string($definition) && !$definition instanceof Closure) {
            throw new BoxException("Error `{$name}` is not a closure definition dependency can't use it as a factory definition.");
        }
        $this->_set($name, $definition, 'factory');
    }
public function factory($name, $definition)
    {
        if (!is_string($definition) && !$definition instanceof Closure) {
            throw new BoxException("Error `{$name}` is not a closure definition dependency can't use it as a factory definition.");
        }
        $this->_set($name, $definition, 'factory');
    }
public function factory ( $ name , $ definition ) { if ( ! is_string ( $ definition ) && ! $ definition instanceof Closure ) { throw new BoxException ( "Error `{$name}` is not a closure definition dependency can't use it as a factory definition." ) ; } $ this -> _set ( $ name , $ definition , 'factory' ) ; }
Defining a factory.

@param  string          $id         The name of the definition.
@param  string|Closure  $definition A fully namespaced classname or a closure.
@throws BoxException if the definition is not a closure or a string.
Defining a factory .