1 | <?php |
||
13 | class FnStream implements StreamInterface |
||
14 | { |
||
15 | const SLOTS = ['__toString', 'close', 'detach', 'rewind', |
||
16 | 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', |
||
17 | 'isReadable', 'read', 'getContents', 'getMetadata']; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $methods; |
||
23 | |||
24 | /** |
||
25 | * @param array $methods Hash of method name to a callable. |
||
26 | */ |
||
27 | 11 | public function __construct(array $methods) |
|
36 | |||
37 | /** |
||
38 | * Lazily determine which methods are not implemented. |
||
39 | * @throws \BadMethodCallException |
||
40 | */ |
||
41 | 1 | public function __get($name) |
|
46 | |||
47 | /** |
||
48 | * The close method is called on the underlying stream only if possible. |
||
49 | */ |
||
50 | 11 | public function __destruct() |
|
56 | |||
57 | /** |
||
58 | * Adds custom functionality to an underlying stream by intercepting |
||
59 | * specific method calls. |
||
60 | * |
||
61 | * @param StreamInterface $stream Stream to decorate |
||
62 | * @param array $methods Hash of method name to a closure |
||
63 | * |
||
64 | * @return FnStream |
||
65 | */ |
||
66 | 6 | public static function decorate(StreamInterface $stream, array $methods) |
|
76 | |||
77 | 1 | public function __toString() |
|
81 | |||
82 | 1 | public function close() |
|
86 | |||
87 | 1 | public function detach() |
|
91 | |||
92 | 6 | public function getSize() |
|
96 | |||
97 | 2 | public function tell() |
|
101 | |||
102 | 5 | public function eof() |
|
106 | |||
107 | 4 | public function isSeekable() |
|
111 | |||
112 | 3 | public function rewind() |
|
116 | |||
117 | 2 | public function seek($offset, $whence = SEEK_SET) |
|
121 | |||
122 | 1 | public function isWritable() |
|
126 | |||
127 | 2 | public function write($string) |
|
131 | |||
132 | 4 | public function isReadable() |
|
136 | |||
137 | 7 | public function read($length) |
|
141 | |||
142 | 1 | public function getContents() |
|
146 | |||
147 | 4 | public function getMetadata($key = null) |
|
151 | } |
||
152 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.