Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 protected function doAttach($stream)
 {
     if (!$stream instanceof StreamInterface) {
         throw HttpAdapterException::streamIsNotValid($stream, get_class($this), 'GuzzleHttp\\Stream\\StreamInterface');
     }
     $this->stream = $stream;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 protected function doAttach($stream)
 {
     if (!is_resource($stream)) {
         throw HttpAdapterException::streamIsNotValid($stream, get_class($this), 'resource');
     }
     $this->resource = $stream;
     $metadata = $this->getMetadata();
     $this->cache['readable'] = isset(self::$modes['read'][$metadata['mode']]);
     $this->cache['writable'] = isset(self::$modes['write'][$metadata['mode']]);
     $this->cache['seekable'] = $metadata['seekable'];
     $this->cache['local'] = stream_is_local($this->resource);
     $this->cache['uri'] = $metadata['uri'];
 }