}
// can be handled by built in PHP functionality
- $content = file_get_contents('php://input');
+ $content = static::getPhpInputContent();
$variables = json_decode($content);
{
$result = ['variables' => [], 'files' => []];
- $stream = fopen('php://input', 'rb');
+ $stream = static::getPhpInputStream();
$sanity = fgets($stream, strlen($boundary) + 5);
return $variables;
}
+
+ /**
+ * Returns the current PHP input stream
+ * Mainly used for test doubling
+ * @return false|resource
+ */
+ protected static function getPhpInputStream()
+ {
+ return fopen('php://input', 'rb');
+ }
+
+ /**
+ * Returns the content of the current PHP input
+ * Mainly used for test doubling
+ * @return false|string
+ */
+ protected static function getPhpInputContent()
+ {
+ return file_get_contents('php://input');
+ }
}