protected function registerType(
        $type,
        $implements,
        $name,
        $class,
        $instantiate = false
    ) {
        $name = strtolower($name);
        $refl = new \ReflectionClass($class);
        if (!$refl->implementsInterface($implements)) {
            $message = sprintf('Class must implement %s', $implements);
            throw new \InvalidArgumentException($message);
        }
        if ($instantiate) {
            $class = new $class;
        }

        $this->{$type}[$name] = $class;
    }
protected function registerType(
        $type,
        $implements,
        $name,
        $class,
        $instantiate = false
    ) {
        $name = strtolower($name);
        $refl = new \ReflectionClass($class);
        if (!$refl->implementsInterface($implements)) {
            $message = sprintf('Class must implement %s', $implements);
            throw new \InvalidArgumentException($message);
        }
        if ($instantiate) {
            $class = new $class;
        }

        $this->{$type}[$name] = $class;
    }
protected function registerType ( $ type , $ implements , $ name , $ class , $ instantiate = false ) { $ name = strtolower ( $ name ) ; $ refl = new \ ReflectionClass ( $ class ) ; if ( ! $ refl -> implementsInterface ( $ implements ) ) { $ message = sprintf ( 'Class must implement %s' , $ implements ) ; throw new \ InvalidArgumentException ( $ message ) ; } if ( $ instantiate ) { $ class = new $ class ; } $ this -> { $ type } [ $ name ] = $ class ; }
Register a type with the factory by name

This is an internal method to check if a provided class name implements
an interface, and if it does to append that class to an internal array
by name.

@param string  $type        The name of the variable to store the class
@param string  $implements  The interface to validate against
@param string  $name        The name of this particular class
@param string  $class       The fully qualified class name
@param boolean $instantiate Should the class be stored instantiated

@return void
@throws InvalidArgumentException If class does not implement interface
Register a type with the factory by name