* {@inheritdoc}
*/
class RequestStackContext extends BaseRequestStackContext {
- //RequestStack instance
- private $requestStack;
-
- //Base path
- private $basePath;
-
/**
* {@inheritdoc}
*/
- public function __construct(RequestStack $requestStack, string $basePath = '', bool $secure = false) {
+ public function __construct(protected RequestStack $requestStack, protected string $basePath = '', protected bool $secure = false) {
//Call parent constructor
parent::__construct($requestStack, $basePath, $secure);
-
- //Set request stack
- $this->requestStack = $requestStack;
-
- //Set base path
- $this->basePath = $basePath;
}
/**
*/
public function getBaseUrl(): string {
//Without request
- if (!$request = $this->requestStack->getMasterRequest()) {
+ if (!$request = $this->requestStack->getMainRequest()) {
//Return base path
return $this->basePath;
}