public function register($class)
    {
        if ($this->initialized) {
            throw new RuntimeException(
                'The components have already been initialized.'
            );
        }
        if (! class_exists($class)) {
            throw new RuntimeException(sprintf(
                'The component "%s" not exists.',
                $class
            ));
        }
        $component = new $class();
        if (! $component instanceof ComponentInterface) {
            throw new InvalidArgumentException(sprintf(
                'The component "%s" must implement "%s".',
                $class,
                ComponentInterface::CLASS
            ));
        }

        $this->container[$class] = $component;

        return md5($class . $component->getVersion());
    }
public function register($class)
    {
        if ($this->initialized) {
            throw new RuntimeException(
                'The components have already been initialized.'
            );
        }
        if (! class_exists($class)) {
            throw new RuntimeException(sprintf(
                'The component "%s" not exists.',
                $class
            ));
        }
        $component = new $class();
        if (! $component instanceof ComponentInterface) {
            throw new InvalidArgumentException(sprintf(
                'The component "%s" must implement "%s".',
                $class,
                ComponentInterface::CLASS
            ));
        }

        $this->container[$class] = $component;

        return md5($class . $component->getVersion());
    }
public function register ( $ class ) { if ( $ this -> initialized ) { throw new RuntimeException ( 'The components have already been initialized.' ) ; } if ( ! class_exists ( $ class ) ) { throw new RuntimeException ( sprintf ( 'The component "%s" not exists.' , $ class ) ) ; } $ component = new $ class ( ) ; if ( ! $ component instanceof ComponentInterface ) { throw new InvalidArgumentException ( sprintf ( 'The component "%s" must implement "%s".' , $ class , ComponentInterface :: CLASS ) ) ; } $ this -> container [ $ class ] = $ component ; return md5 ( $ class . $ component -> getVersion ( ) ) ; }
Register the component.

@param string $class The class of component

@throws \InvalidArgumentException If the specified class not implements
the Es\Component\ComponentInterface
@throws \RuntimeException

- If If the components have already been initialized
- If the specified class of component does not exists

@return string The hash of component state
Register the component .