ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
GuzzleHttp\Psr7\StreamWrapper Class Reference

Converts Guzzle streams into PHP stream resources. More...

+ Collaboration diagram for GuzzleHttp\Psr7\StreamWrapper:

Public Member Functions

 stream_open ($path, $mode, $options, &$opened_path)
 
 stream_read ($count)
 
 stream_write ($data)
 
 stream_tell ()
 
 stream_eof ()
 
 stream_seek ($offset, $whence)
 
 stream_stat ()
 

Static Public Member Functions

static getResource (StreamInterface $stream)
 Returns a resource representing the stream. More...
 
static register ()
 Registers the stream wrapper if needed. More...
 

Data Fields

 $context
 

Private Attributes

 $stream
 
 $mode
 

Detailed Description

Converts Guzzle streams into PHP stream resources.

Definition at line 9 of file StreamWrapper.php.

Member Function Documentation

◆ getResource()

static GuzzleHttp\Psr7\StreamWrapper::getResource ( StreamInterface  $stream)
static

Returns a resource representing the stream.

Parameters
StreamInterface$streamThe stream to get a resource for
Returns
resource
Exceptions

Definition at line 28 of file StreamWrapper.php.

References GuzzleHttp\Psr7\StreamWrapper\$mode, Psr\Http\Message\StreamInterface\isReadable(), and Psr\Http\Message\StreamInterface\isWritable().

Referenced by GuzzleHttp\Psr7\InflateStream\__construct().

29  {
30  self::register();
31 
32  if ($stream->isReadable()) {
33  $mode = $stream->isWritable() ? 'r+' : 'r';
34  } elseif ($stream->isWritable()) {
35  $mode = 'w';
36  } else {
37  throw new \InvalidArgumentException('The stream must be readable, '
38  . 'writable, or both.');
39  }
40 
41  return fopen('guzzle://stream', $mode, null, stream_context_create([
42  'guzzle' => ['stream' => $stream]
43  ]));
44  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ register()

static GuzzleHttp\Psr7\StreamWrapper::register ( )
static

Registers the stream wrapper if needed.

Definition at line 49 of file StreamWrapper.php.

50  {
51  if (!in_array('guzzle', stream_get_wrappers())) {
52  stream_wrapper_register('guzzle', __CLASS__);
53  }
54  }

◆ stream_eof()

GuzzleHttp\Psr7\StreamWrapper::stream_eof ( )

Definition at line 85 of file StreamWrapper.php.

86  {
87  return $this->stream->eof();
88  }

◆ stream_open()

GuzzleHttp\Psr7\StreamWrapper::stream_open (   $path,
  $mode,
  $options,
$opened_path 
)

Definition at line 56 of file StreamWrapper.php.

References GuzzleHttp\Psr7\StreamWrapper\$mode, and $options.

57  {
58  $options = stream_context_get_options($this->context);
59 
60  if (!isset($options['guzzle']['stream'])) {
61  return false;
62  }
63 
64  $this->mode = $mode;
65  $this->stream = $options['guzzle']['stream'];
66 
67  return true;
68  }
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20

◆ stream_read()

GuzzleHttp\Psr7\StreamWrapper::stream_read (   $count)

Definition at line 70 of file StreamWrapper.php.

71  {
72  return $this->stream->read($count);
73  }

◆ stream_seek()

GuzzleHttp\Psr7\StreamWrapper::stream_seek (   $offset,
  $whence 
)

Definition at line 90 of file StreamWrapper.php.

91  {
92  $this->stream->seek($offset, $whence);
93 
94  return true;
95  }

◆ stream_stat()

GuzzleHttp\Psr7\StreamWrapper::stream_stat ( )

Definition at line 97 of file StreamWrapper.php.

References GuzzleHttp\Psr7\StreamWrapper\$mode.

98  {
99  static $modeMap = [
100  'r' => 33060,
101  'r+' => 33206,
102  'w' => 33188
103  ];
104 
105  return [
106  'dev' => 0,
107  'ino' => 0,
108  'mode' => $modeMap[$this->mode],
109  'nlink' => 0,
110  'uid' => 0,
111  'gid' => 0,
112  'rdev' => 0,
113  'size' => $this->stream->getSize() ?: 0,
114  'atime' => 0,
115  'mtime' => 0,
116  'ctime' => 0,
117  'blksize' => 0,
118  'blocks' => 0
119  ];
120  }

◆ stream_tell()

GuzzleHttp\Psr7\StreamWrapper::stream_tell ( )

Definition at line 80 of file StreamWrapper.php.

81  {
82  return $this->stream->tell();
83  }

◆ stream_write()

GuzzleHttp\Psr7\StreamWrapper::stream_write (   $data)

Definition at line 75 of file StreamWrapper.php.

References $data.

76  {
77  return (int) $this->stream->write($data);
78  }

Field Documentation

◆ $context

GuzzleHttp\Psr7\StreamWrapper::$context

Definition at line 12 of file StreamWrapper.php.

◆ $mode

GuzzleHttp\Psr7\StreamWrapper::$mode
private

◆ $stream

GuzzleHttp\Psr7\StreamWrapper::$stream
private

Definition at line 15 of file StreamWrapper.php.


The documentation for this class was generated from the following file: