1 | <?php |
||
19 | class StreamMetaData |
||
20 | { |
||
21 | /** |
||
22 | * Mapping between array keys and properties |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | private static $propertyMap = [ |
||
27 | 'timed_out' => 'isTimedOut', |
||
28 | 'blocked' => 'isBlocked', |
||
29 | 'eof' => 'isEOF', |
||
30 | 'unread_bytes' => 'unreadBytesCount', |
||
31 | 'stream_type' => 'streamType', |
||
32 | 'wrapper_type' => 'wrapperType', |
||
33 | 'wrapper_data' => 'wrapperData', |
||
34 | 'filters' => 'filterList', |
||
35 | 'mode' => 'mode', |
||
36 | 'seekable' => 'isSeekable', |
||
37 | 'uri' => 'uri', |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * TRUE if the stream timed out while waiting for data on the last call to fread() or fgets(). |
||
42 | * |
||
43 | * @var bool |
||
44 | */ |
||
45 | public $isTimedOut; |
||
46 | |||
47 | /** |
||
48 | * TRUE if the stream has reached end-of-file. |
||
49 | * |
||
50 | * @var bool |
||
51 | */ |
||
52 | public $isBlocked; |
||
53 | |||
54 | /** |
||
55 | * TRUE if the stream has reached end-of-file. |
||
56 | * |
||
57 | * @var bool |
||
58 | */ |
||
59 | public $isEOF; |
||
60 | |||
61 | /** |
||
62 | * The number of bytes currently contained in the PHP's own internal buffer. |
||
63 | * |
||
64 | * @var integer |
||
65 | */ |
||
66 | public $unreadBytesCount; |
||
67 | |||
68 | /** |
||
69 | * A label describing the underlying implementation of the stream. |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | public $streamType; |
||
74 | |||
75 | /** |
||
76 | * A label describing the protocol wrapper implementation layered over the stream. |
||
77 | * |
||
78 | * @var string |
||
79 | */ |
||
80 | public $wrapperType; |
||
81 | |||
82 | /** |
||
83 | * Wrapper-specific data attached to this stream. |
||
84 | * |
||
85 | * @var mixed |
||
86 | */ |
||
87 | public $wrapperData; |
||
88 | |||
89 | /** |
||
90 | * Array containing the names of any filters that have been stacked onto this stream. |
||
91 | * |
||
92 | * @var array |
||
93 | */ |
||
94 | public $filterList; |
||
95 | |||
96 | /** |
||
97 | * The type of access required for this stream |
||
98 | * |
||
99 | * @var string |
||
100 | */ |
||
101 | public $mode; |
||
102 | |||
103 | /** |
||
104 | * Whether the current stream can be seeked. |
||
105 | * |
||
106 | * @var bool |
||
107 | */ |
||
108 | public $isSeekable; |
||
109 | |||
110 | /** |
||
111 | * The URI/filename associated with this stream. |
||
112 | * |
||
113 | * @var string |
||
114 | */ |
||
115 | public $uri; |
||
116 | |||
117 | /** |
||
118 | * The contents of the stream. |
||
119 | * |
||
120 | * @var string |
||
121 | */ |
||
122 | public $source; |
||
123 | |||
124 | /** |
||
125 | * Creates metadata object from stream |
||
126 | * |
||
127 | * @param resource $stream Instance of stream |
||
128 | * @param string $source Source code or null |
||
129 | * @throws \InvalidArgumentException for invalid stream |
||
130 | */ |
||
131 | 38 | public function __construct($stream, $source = null) |
|
146 | } |
||
147 |