moved a test in the constructor
This commit is contained in:
parent
e44b8ba521
commit
8717d4425e
@ -45,6 +45,10 @@ class StreamedResponse extends Response
|
||||
parent::__construct(null, $status, $headers);
|
||||
|
||||
$this->callback = $callback;
|
||||
if (!is_callable($this->callback)) {
|
||||
throw new \LogicException('The Response callback must be a valid PHP callable.');
|
||||
}
|
||||
|
||||
$this->streamed = false;
|
||||
}
|
||||
|
||||
@ -76,10 +80,6 @@ class StreamedResponse extends Response
|
||||
|
||||
$this->streamed = true;
|
||||
|
||||
if (!is_callable($this->callback)) {
|
||||
throw new \LogicException('The Response callback is not a valid PHP callable.');
|
||||
}
|
||||
|
||||
call_user_func($this->callback);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user