This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Thruster\Component\HttpMessage; |
||
4 | |||
5 | use Psr\Http\Message\StreamInterface; |
||
6 | |||
7 | /** |
||
8 | * Class FnStream |
||
9 | * |
||
10 | * @package Thruster\Component\HttpMessage |
||
11 | * @author Aurimas Niekis <[email protected]> |
||
12 | */ |
||
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) |
|
28 | { |
||
29 | 11 | $this->methods = $methods; |
|
30 | |||
31 | // Create the functions on the class |
||
32 | 11 | foreach ($methods as $name => $fn) { |
|
33 | 9 | $this->{'_fn_' . $name} = $fn; |
|
34 | } |
||
35 | 11 | } |
|
36 | |||
37 | /** |
||
38 | * Lazily determine which methods are not implemented. |
||
39 | * @throws \BadMethodCallException |
||
40 | */ |
||
41 | 1 | public function __get($name) |
|
42 | { |
||
43 | 1 | throw new \BadMethodCallException(str_replace('_fn_', '', $name) |
|
44 | 1 | . '() is not implemented in the FnStream'); |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * The close method is called on the underlying stream only if possible. |
||
49 | */ |
||
50 | 11 | public function __destruct() |
|
51 | { |
||
52 | 11 | if (isset($this->_fn_close)) { |
|
53 | 7 | call_user_func($this->_fn_close); |
|
0 ignored issues
–
show
|
|||
54 | } |
||
55 | 11 | } |
|
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) |
|
67 | { |
||
68 | // If any of the required methods were not provided, then simply |
||
69 | // proxy to the decorated stream. |
||
70 | 6 | foreach (array_diff(static::SLOTS, array_keys($methods)) as $diff) { |
|
71 | 6 | $methods[$diff] = [$stream, $diff]; |
|
72 | } |
||
73 | |||
74 | 6 | return new self($methods); |
|
75 | } |
||
76 | |||
77 | 1 | public function __toString() |
|
78 | { |
||
79 | 1 | return call_user_func($this->_fn___toString); |
|
0 ignored issues
–
show
The property
_fn___toString does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
80 | } |
||
81 | |||
82 | 1 | public function close() |
|
83 | { |
||
84 | 1 | return call_user_func($this->_fn_close); |
|
0 ignored issues
–
show
The property
_fn_close does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
85 | } |
||
86 | |||
87 | 1 | public function detach() |
|
88 | { |
||
89 | 1 | return call_user_func($this->_fn_detach); |
|
0 ignored issues
–
show
The property
_fn_detach does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
90 | } |
||
91 | |||
92 | 6 | public function getSize() |
|
93 | { |
||
94 | 6 | return call_user_func($this->_fn_getSize); |
|
0 ignored issues
–
show
The property
_fn_getSize does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
95 | } |
||
96 | |||
97 | 2 | public function tell() |
|
98 | { |
||
99 | 2 | return call_user_func($this->_fn_tell); |
|
0 ignored issues
–
show
The property
_fn_tell does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
100 | } |
||
101 | |||
102 | 5 | public function eof() |
|
103 | { |
||
104 | 5 | return call_user_func($this->_fn_eof); |
|
0 ignored issues
–
show
The property
_fn_eof does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
105 | } |
||
106 | |||
107 | 4 | public function isSeekable() |
|
108 | { |
||
109 | 4 | return call_user_func($this->_fn_isSeekable); |
|
0 ignored issues
–
show
The property
_fn_isSeekable does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
110 | } |
||
111 | |||
112 | 3 | public function rewind() |
|
113 | { |
||
114 | 3 | call_user_func($this->_fn_rewind); |
|
0 ignored issues
–
show
The property
_fn_rewind does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
115 | 3 | } |
|
116 | |||
117 | 2 | public function seek($offset, $whence = SEEK_SET) |
|
118 | { |
||
119 | 2 | call_user_func($this->_fn_seek, $offset, $whence); |
|
0 ignored issues
–
show
The property
_fn_seek does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
120 | 1 | } |
|
121 | |||
122 | 1 | public function isWritable() |
|
123 | { |
||
124 | 1 | return call_user_func($this->_fn_isWritable); |
|
0 ignored issues
–
show
The property
_fn_isWritable does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
125 | } |
||
126 | |||
127 | 2 | public function write($string) |
|
128 | { |
||
129 | 2 | return call_user_func($this->_fn_write, $string); |
|
0 ignored issues
–
show
The property
_fn_write does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
130 | } |
||
131 | |||
132 | 4 | public function isReadable() |
|
133 | { |
||
134 | 4 | return call_user_func($this->_fn_isReadable); |
|
0 ignored issues
–
show
The property
_fn_isReadable does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
135 | } |
||
136 | |||
137 | 7 | public function read($length) |
|
138 | { |
||
139 | 7 | return call_user_func($this->_fn_read, $length); |
|
0 ignored issues
–
show
The property
_fn_read does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
140 | } |
||
141 | |||
142 | 1 | public function getContents() |
|
143 | { |
||
144 | 1 | return call_user_func($this->_fn_getContents); |
|
0 ignored issues
–
show
The property
_fn_getContents does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
145 | } |
||
146 | |||
147 | 4 | public function getMetadata($key = null) |
|
148 | { |
||
149 | 4 | return call_user_func($this->_fn_getMetadata, $key); |
|
0 ignored issues
–
show
The property
_fn_getMetadata does not exist on object<Thruster\Component\HttpMessage\FnStream> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
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. ![]() |
|||
150 | } |
||
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.