-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
135 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* UserFrosting Core Sprinkle (http://www.userfrosting.com) | ||
* | ||
* @link https://github.com/userfrosting/sprinkle-core | ||
* @copyright Copyright (c) 2013-2024 Alexander Weissman & Louis Charette | ||
* @license https://github.com/userfrosting/sprinkle-core/blob/master/LICENSE.md (MIT License) | ||
*/ | ||
|
||
namespace UserFrosting\Sprinkle\Core\Util; | ||
|
||
use Psr\Http\Message\ServerRequestInterface; | ||
|
||
/** | ||
* Helper methods to store and retrieve the server request. | ||
* The request can be null if it's not set yet (eg. before the request is saved | ||
* by the middleware) or if there's no server request (eg. in a CLI command). | ||
*/ | ||
class RequestContainer | ||
{ | ||
/** | ||
* @var ServerRequestInterface|null | ||
*/ | ||
protected ?ServerRequestInterface $request = null; | ||
|
||
/** | ||
* Return the server request. | ||
* | ||
* @return ServerRequestInterface|null | ||
*/ | ||
public function getRequest(): ?ServerRequestInterface | ||
{ | ||
return $this->request; | ||
} | ||
|
||
/** | ||
* Store the server request. | ||
* | ||
* @param ServerRequestInterface $request | ||
*/ | ||
public function setRequest(ServerRequestInterface $request): void | ||
{ | ||
$this->request = $request; | ||
} | ||
} |
Oops, something went wrong.