original_string: protected function _ensureWritable()
      {
          if (!$this->valid()) {
              throw new RuntimeException('Cannot write on a closed stream.');
          }
          if (!$this->isWritable()) {
              $mode = $this->meta('mode');
              throw new RuntimeException("Cannot write on a non-writable stream (mode is `'{$mode}'`).");
          }
      }
code: protected function _ensureWritable()
      {
          if (!$this->valid()) {
              throw new RuntimeException('Cannot write on a closed stream.');
          }
          if (!$this->isWritable()) {
              $mode = $this->meta('mode');
              throw new RuntimeException("Cannot write on a non-writable stream (mode is `'{$mode}'`).");
          }
      }
code_tokens: protected function _ensureWritable ( ) { if ( ! $ this -> valid ( ) ) { throw new RuntimeException ( 'Cannot write on a closed stream.' ) ; } if ( ! $ this -> isWritable ( ) ) { $ mode = $ this -> meta ( 'mode' ) ; throw new RuntimeException ( "Cannot write on a non-writable stream (mode is `'{$mode}'`)." ) ; } }
docstring: Throw an exception if a stream is not writable.
docstring_tokens: Throw an exception if a stream is not writable .