original_string: public function put($name, $value)
      {
          if (is_object($value) && !$this->isValidObjectInstance($value)) {
              throw new InvalidCollectionItemInstanceException(sprintf('%s must implement %s', $name, $this->classname));
          }
  
          $this->items[$name] = $value;
  
          return $this->items[$name];
      }
code: public function put($name, $value)
      {
          if (is_object($value) && !$this->isValidObjectInstance($value)) {
              throw new InvalidCollectionItemInstanceException(sprintf('%s must implement %s', $name, $this->classname));
          }
  
          $this->items[$name] = $value;
  
          return $this->items[$name];
      }
code_tokens: public function put ( $ name , $ value ) { if ( is_object ( $ value ) && ! $ this -> isValidObjectInstance ( $ value ) ) { throw new InvalidCollectionItemInstanceException ( sprintf ( '%s must implement %s' , $ name , $ this -> classname ) ) ; } $ this -> items [ $ name ] = $ value ; return $ this -> items [ $ name ] ; }
docstring: Add a new item to collection.
  
  @param string $name
  @param mixed  $value
  
  @return self
docstring_tokens: Add a new item to collection .