public function add($name, Closure $closure)
  {
    if (!$this->has($name)) {
      $service = new Service();

      $closure($service);

      $this->services[$name] = $service;

      return $this;
    }

    throw new ServiceAlreadyExists("Service '" . $name . "' already exists.");
  }
public function add($name, Closure $closure)
  {
    if (!$this->has($name)) {
      $service = new Service();

      $closure($service);

      $this->services[$name] = $service;

      return $this;
    }

    throw new ServiceAlreadyExists("Service '" . $name . "' already exists.");
  }
public function add ( $ name , Closure $ closure ) { if ( ! $ this -> has ( $ name ) ) { $ service = new Service ( ) ; $ closure ( $ service ) ; $ this -> services [ $ name ] = $ service ; return $ this ; } throw new ServiceAlreadyExists ( "Service '" . $ name . "' already exists." ) ; }
Add a new service to the wrapper

@param string  $name
@param Closure $closure

@return $this
@throws ServiceAlreadyExists
Add a new service to the wrapper