original_string: protected function _initResource($config)
      {
          if (!empty($config['data']) && !empty($config['filename'])) {
              throw new InvalidArgumentException("The `'data'` or `'filename'` option must be defined.");
          }
          if ($config['filename']) {
              $this->_filename = $config['filename'];
              if ($this->_filename === 'php://input') {
                  $this->_mode = 'r';
              }
              $this->_resource = fopen($this->_filename, $this->_mode);
              return;
          }
          if (is_resource($config['data'])) {
              $this->_resource = $config['data'];
              return;
          } elseif (is_scalar($config['data'])) {
              $this->_resource = fopen('php://temp', 'r+');
              fwrite($this->_resource, (string) $config['data']);
              rewind($this->_resource);
          }
      }
code: protected function _initResource($config)
      {
          if (!empty($config['data']) && !empty($config['filename'])) {
              throw new InvalidArgumentException("The `'data'` or `'filename'` option must be defined.");
          }
          if ($config['filename']) {
              $this->_filename = $config['filename'];
              if ($this->_filename === 'php://input') {
                  $this->_mode = 'r';
              }
              $this->_resource = fopen($this->_filename, $this->_mode);
              return;
          }
          if (is_resource($config['data'])) {
              $this->_resource = $config['data'];
              return;
          } elseif (is_scalar($config['data'])) {
              $this->_resource = fopen('php://temp', 'r+');
              fwrite($this->_resource, (string) $config['data']);
              rewind($this->_resource);
          }
      }
code_tokens: protected function _initResource ( $ config ) { if ( ! empty ( $ config [ 'data' ] ) && ! empty ( $ config [ 'filename' ] ) ) { throw new InvalidArgumentException ( "The `'data'` or `'filename'` option must be defined." ) ; } if ( $ config [ 'filename' ] ) { $ this -> _filename = $ config [ 'filename' ] ; if ( $ this -> _filename === 'php://input' ) { $ this -> _mode = 'r' ; } $ this -> _resource = fopen ( $ this -> _filename , $ this -> _mode ) ; return ; } if ( is_resource ( $ config [ 'data' ] ) ) { $ this -> _resource = $ config [ 'data' ] ; return ; } elseif ( is_scalar ( $ config [ 'data' ] ) ) { $ this -> _resource = fopen ( 'php://temp' , 'r+' ) ; fwrite ( $ this -> _resource , ( string ) $ config [ 'data' ] ) ; rewind ( $ this -> _resource ) ; } }
docstring: Init the stream resource.
  
  @param array $config The constructor configuration array.
docstring_tokens: Init the stream resource .