Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit f7b7df9

Browse files
authored
Merge pull request #41 from mremi/master
Added missing property declaration and handled status code of Drupal
2 parents 884d752 + 5ddeaf2 commit f7b7df9

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Drupal/Drupal.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ class Drupal implements DrupalInterface
5252
*/
5353
protected $state;
5454

55+
/**
56+
* @var Response
57+
*/
58+
protected $response;
59+
5560
/**
5661
* @var array
5762
*/
@@ -87,7 +92,7 @@ public function __construct($root, UserManagerInterface $userManager)
8792
{
8893
$this->root = $root;
8994
$this->state = self::STATE_FRESH;
90-
$this->response = new Response;
95+
$this->response = new Response();
9196
$this->encapsulated = false;
9297
$this->disableResponse = false;
9398
$this->userManager = $userManager;
@@ -227,6 +232,12 @@ public function shutdown($level)
227232
$this->response->headers->set($name, $value);
228233
}
229234

235+
$statusCode = http_response_code();
236+
237+
if ($statusCode !== false) {
238+
$this->response->setStatusCode($statusCode);
239+
}
240+
230241
$content = ob_get_contents();
231242

232243
$this->response->setContent($content);
@@ -401,6 +412,12 @@ public function render()
401412

402413
$this->response->setContent($content);
403414

415+
$statusCode = http_response_code();
416+
417+
if ($statusCode !== false) {
418+
$this->response->setStatusCode($statusCode);
419+
}
420+
404421
$this->state = self::STATE_RESPONSE;
405422
}
406423

0 commit comments

Comments
 (0)