public function bind($id, $definition = [], $replace = true)
    {
        $container = Container::$instance;
        if (!$replace && $container->has($id)) {
            throw new InvalidParamException("Can not bind service, service '$id' is already exists.");
        }

        if (is_array($definition) && !isset($definition['class'])) {
            throw new InvalidConfigException("The configuration for the \"$id\" service must contain a \"class\" element.");
        }

        $container->setSingleton($id, $definition);
    }
public function bind($id, $definition = [], $replace = true)
    {
        $container = Container::$instance;
        if (!$replace && $container->has($id)) {
            throw new InvalidParamException("Can not bind service, service '$id' is already exists.");
        }

        if (is_array($definition) && !isset($definition['class'])) {
            throw new InvalidConfigException("The configuration for the \"$id\" service must contain a \"class\" element.");
        }

        $container->setSingleton($id, $definition);
    }
public function bind ( $ id , $ definition = [ ] , $ replace = true ) { $ container = Container :: $ instance ; if ( ! $ replace && $ container -> has ( $ id ) ) { throw new InvalidParamException ( "Can not bind service, service '$id' is already exists." ) ; } if ( is_array ( $ definition ) && ! isset ( $ definition [ 'class' ] ) ) { throw new InvalidConfigException ( "The configuration for the \"$id\" service must contain a \"class\" element." ) ; } $ container -> setSingleton ( $ id , $ definition ) ; }
Bind a service definition to this service locator.

@param $id
@param array $definition
@param boolean $replace Replace existing services.
@throws InvalidConfigException
Bind a service definition to this service locator .