Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -28,10 +28,9 @@ class StreamedResponse extends Response
{
protected $callback;
protected $streamed;
private $headersSent;
/**
* Constructor.
*
* @param callable|null $callback A valid PHP callback or null to set it later
* @param int $status The response status code
* @param array $headers An array of response headers
@@ -44,6 +43,7 @@ class StreamedResponse extends Response
$this->setCallback($callback);
}
$this->streamed = false;
$this->headersSent = false;
}
/**
@@ -53,7 +53,7 @@ class StreamedResponse extends Response
* @param int $status The response status code
* @param array $headers An array of response headers
*
* @return StreamedResponse
* @return static
*/
public static function create($callback = null, $status = 200, $headers = array())
{
@@ -64,21 +64,45 @@ class StreamedResponse extends Response
* Sets the PHP callback associated with this Response.
*
* @param callable $callback A valid PHP callback
*
* @return $this
*/
public function setCallback(callable $callback)
{
$this->callback = $callback;
return $this;
}
/**
* {@inheritdoc}
*
* This method only sends the headers once.
*
* @return $this
*/
public function sendHeaders()
{
if ($this->headersSent) {
return $this;
}
$this->headersSent = true;
return parent::sendHeaders();
}
/**
* {@inheritdoc}
*
* This method only sends the content once.
*
* @return $this
*/
public function sendContent()
{
if ($this->streamed) {
return;
return $this;
}
$this->streamed = true;
@@ -87,19 +111,25 @@ class StreamedResponse extends Response
throw new \LogicException('The Response callback must not be null.');
}
call_user_func($this->callback);
\call_user_func($this->callback);
return $this;
}
/**
* {@inheritdoc}
*
* @throws \LogicException when the content is not null
*
* @return $this
*/
public function setContent($content)
{
if (null !== $content) {
throw new \LogicException('The content cannot be set on a StreamedResponse instance.');
}
return $this;
}
/**
@@ -111,4 +141,16 @@ class StreamedResponse extends Response
{
return false;
}
/**
* {@inheritdoc}
*
* @return $this
*/
public function setNotModified()
{
$this->setCallback(function () {});
return parent::setNotModified();
}
}