Default router for Hubleto project.
\Hubleto\Framework\Router
Parent class | \Hubleto\Framework\Core |
Implements | \Hubleto\Framework\Interfaces\RouterInterface |
Constants
Constant | Visibility | Type | Value |
---|---|---|---|
HTTP_GET |
public | 'HTTP_GET' |
Properties
routing
public $routing
route
protected string $route
routesHttpGet
protected array $routesHttpGet
routeVars
protected array $routeVars
Methods
__construct
public __construct(): mixed
init
public init(): void
extractParamsFromRequest
public extractParamsFromRequest(): array
extractRouteFromRequest
public extractRouteFromRequest(): string
isAjax
public isAjax(): bool
get
public get(array $routes): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$routes |
array |
getRoutes
public getRoutes(string $method): array
Parameters:
Parameter | Type | Description |
---|---|---|
$method |
string |
getRoute
public getRoute(): string
setRoute
public setRoute(string $route): void
Parameters:
Parameter | Type | Description |
---|---|---|
$route |
string |
parseRoute
array<string, array<string, string>>
public parseRoute(string $method, string $route): array
Parameters:
Parameter | Type | Description |
---|---|---|
$method |
string | |
$route |
string |
setRouteVars
public setRouteVars(array $routeVars): void
Parameters:
Parameter | Type | Description |
---|---|---|
$routeVars |
array |
getRouteVars
public getRouteVars(): array
getRouteVar
public getRouteVar(string|int $varIndex): string
Parameters:
Parameter | Type | Description |
---|---|---|
$varIndex |
string|int |
routeVarAsString
public routeVarAsString(string|int $varIndex): string
Parameters:
Parameter | Type | Description |
---|---|---|
$varIndex |
string|int |
routeVarAsInteger
public routeVarAsInteger(string|int $varIndex): int
Parameters:
Parameter | Type | Description |
---|---|---|
$varIndex |
string|int |
routeVarAsFloat
public routeVarAsFloat(string|int $varIndex): float
Parameters:
Parameter | Type | Description |
---|---|---|
$varIndex |
string|int |
routeVarAsBool
public routeVarAsBool(string|int $varIndex): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$varIndex |
string|int |
getUploadedFile
public getUploadedFile(string $paramName, ?array $defaultValue = null): null|array
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string | |
$defaultValue |
?array |
redirectTo
public redirectTo(string $url, int $code = 302): void
Parameters:
Parameter | Type | Description |
---|---|---|
$url |
string | |
$code |
int |
getUrlParams
public getUrlParams(): array
isUrlParam
public isUrlParam(string $paramName): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string |
urlParamNotEmpty
public urlParamNotEmpty(string $paramName): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string |
setUrlParam
public setUrlParam(string $paramName, string $newValue): void
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string | |
$newValue |
string |
removeUrlParam
public removeUrlParam(string $paramName): void
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string |
urlParamAsString
public urlParamAsString(string $paramName, string $defaultValue = ''): string
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string | |
$defaultValue |
string |
urlParamAsInteger
public urlParamAsInteger(string $paramName, int $defaultValue): int
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string | |
$defaultValue |
int |
urlParamAsFloat
public urlParamAsFloat(string $paramName, float $defaultValue): float
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string | |
$defaultValue |
float |
urlParamAsBool
public urlParamAsBool(string $paramName, bool $defaultValue = false): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string | |
$defaultValue |
bool |
urlParamAsArray
public urlParamAsArray(string $paramName, array $defaultValue = []): array<string,string>
Parameters:
Parameter | Type | Description |
---|---|---|
$paramName |
string | |
$defaultValue |
array |
Inherited methods
__construct
public __construct(): mixed
getServiceStatic
Shortcut for the dependency injection.
public static getServiceStatic(string $service): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$service |
string |
getService
[Description for getService]
public getService(string $service): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$service |
string |
env
Shortcut for the env service.
public env(): \Hubleto\Framework\Env
authProvider
Shortcut for the authentication service.
public authProvider(): \Hubleto\Framework\Interfaces\AuthInterface
db
Shortcut for the database service.
public db(): \Hubleto\Framework\Db
appManager
Shortcut for the app manager service.
public appManager(): \Hubleto\Framework\Interfaces\AppManagerInterface
router
Shortcut for the router service.
public router(): \Hubleto\Framework\Router
hookManager
Shortcut for the hook manager service.
public hookManager(): \Hubleto\Framework\HookManager
sessionManager
Shortcut for the session manager service.
public sessionManager(): \Hubleto\Framework\SessionManager
permissionsManager
Shortcut for the permissions manager service.
public permissionsManager(): \Hubleto\Framework\PermissionsManager
cronManager
Shortcut for the cron manager service.
public cronManager(): \Hubleto\Framework\CronManager
emailProvider
Shortcut for the email provider service.
public emailProvider(): \Hubleto\Framework\EmailProvider
config
Shortcut for the config service.
public config(): \Hubleto\Framework\Interfaces\ConfigManagerInterface
logger
Shortcut for the logger service.
public logger(): \Hubleto\Framework\Logger
locale
Shortcut for the locale service.
public locale(): \Hubleto\Framework\Locale
renderer
Shortcut for the renderer service.
public renderer(): \Hubleto\Framework\Renderer
translator
Shortcut for the translator service.
public translator(): \Hubleto\Framework\Interfaces\TranslatorInterface
getModel
[Description for getModel]
public getModel(string $model): \Hubleto\Framework\Models\Model
Parameters:
Parameter | Type | Description |
---|---|---|
$model |
string |
getController
[Description for getController]
public getController(string $controller): \Hubleto\Framework\Controller
Parameters:
Parameter | Type | Description |
---|---|---|
$controller |
string |
translate
Shorthand for core translate() function. Uses own language dictionary.
public translate(string $string, array $vars = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
string | String to be translated |
$vars |
array |
Return Value:
Translated string.