/**
* true if the default controller is used (support for custom landing page)
- * @var bool
*/
- private $isDefaultController = false;
+ private bool $isDefaultController = false;
/**
* true if the controller was renamed and has already been transformed
- * @var bool
*/
- private $isRenamedController = false;
+ private bool $isRenamedController = false;
/**
* list of available routes
* @var IRequestRoute[]
*/
- private $routes = [];
+ private array $routes = [];
/**
* parsed route data
* Returns true if a route matches. Please bear in mind, that the
* first route that is able to consume all path components is used,
* even if other routes may fit better. Route order is crucial!
- *
- * @return bool
*/
- public function matches()
+ public function matches(): bool
{
foreach ($this->routes as $route) {
if (RequestHandler::getInstance()->isACPRequest() != $route->isACP()) {
/**
* Returns true if route uses default controller.
- *
- * @return bool
*/
- public function isDefaultController()
+ public function isDefaultController(): bool
{
return $this->isDefaultController;
}
/**
* Returns true if the controller was renamed and has already been transformed.
- *
- * @return bool
*/
- public function isRenamedController()
+ public function isRenamedController(): bool
{
return $this->isRenamedController;
}
/**
* Registers route data within $_GET and $_REQUEST.
*/
- private function registerRouteData()
+ private function registerRouteData(): void
{
foreach ($this->routeData as $key => $value) {
$_GET[$key] = $value;
* @return bool true if `$customUrl` passes the sanity check
* @since 3.0
*/
- public static function isValidCustomUrl($customUrl)
+ public static function isValidCustomUrl($customUrl): bool
{
return \preg_match('~^[a-z0-9\-_/]+$~', $customUrl) === 1;
}
/**
* Returns true if this is a secure connection.
- *
- * @return bool
*/
- public static function secureConnection()
+ public static function secureConnection(): bool
{
if (self::$secure === null) {
self::$secure = false;
/**
* Returns HTTP protocol, either 'http://' or 'https://'.
- *
- * @return string
*/
- public static function getProtocol()
+ public static function getProtocol(): string
{
if (empty(self::$protocol)) {
self::$protocol = 'http' . (self::secureConnection() ? 's' : '') . '://';
/**
* Returns protocol and domain name.
- *
- * @return string
*/
- public static function getHost()
+ public static function getHost(): string
{
if (empty(self::$host)) {
self::$host = self::getProtocol() . $_SERVER['HTTP_HOST'];
/**
* Returns absolute domain path.
- *
- * @param array $removeComponents
- * @return string
*/
- public static function getPath(array $removeComponents = [])
+ public static function getPath(array $removeComponents = []): string
{
if (empty(self::$path)) {
// dirname return a single backslash on Windows if there are no parent directories
/**
* Returns current path info component.
- *
- * @return string
*/
- public static function getPathInfo()
+ public static function getPathInfo(): string
{
if (self::$pathInfo === null) {
self::$pathInfo = '';