original_string: protected function attach($newStream)
      {
          if (is_resource($newStream) === false) {
              throw new InvalidArgumentException(__METHOD__ . ' argument must be a valid PHP resource');
          }
  
          if ($this->isAttached() === true) {
              $this->detach();
          }
  
          $this->stream = $newStream;
      }
code: protected function attach($newStream)
      {
          if (is_resource($newStream) === false) {
              throw new InvalidArgumentException(__METHOD__ . ' argument must be a valid PHP resource');
          }
  
          if ($this->isAttached() === true) {
              $this->detach();
          }
  
          $this->stream = $newStream;
      }
code_tokens: protected function attach ( $ newStream ) { if ( is_resource ( $ newStream ) === false ) { throw new InvalidArgumentException ( __METHOD__ . ' argument must be a valid PHP resource' ) ; } if ( $ this -> isAttached ( ) === true ) { $ this -> detach ( ) ; } $ this -> stream = $ newStream ; }
docstring: Attach new resource to this object.
  
  Note: This method is not part of the PSR-7 standard.
  
  @param resource $newStream A PHP resource handle.
  
  @throws InvalidArgumentException If argument is not a valid PHP resource.
docstring_tokens: Attach new resource to this object .