Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tinyrouter-php-class
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
tinyrouter-php-class
Commits
94f256b9
Commit
94f256b9
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update doc blocs
parent
81ce53f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tinyrouter.class.php
+14
-8
14 additions, 8 deletions
src/tinyrouter.class.php
with
14 additions
and
8 deletions
src/tinyrouter.class.php
+
14
−
8
View file @
94f256b9
...
...
@@ -15,7 +15,7 @@
* SERVICING, REPAIR OR CORRECTION.<br>
* <br>
* --------------------------------------------------------------------------------<br>
* @version 1.
0
* @version 1.
1
* @author Axel Hahn
* @link https://github.com/iml-it/appmonitor
* @license GPL
...
...
@@ -34,12 +34,14 @@ class tinyrouter{
/**
* constructor
* @param $aRoutes array array of rout
ing
s
* @param $aRoutes array array of rout
e
s
* @param $sUrl string incoming url
* @return boolean
*/
public
function
__construct
(
$aRoutes
=
[],
$sUrl
=
false
){
public
function
__construct
(
$aRoutes
=
[],
$sUrl
=
false
){
$this
->
setRoutes
(
$aRoutes
);
$this
->
setUrl
(
$sUrl
);
return
true
;
}
// ----------------------------------------------------------------------
...
...
@@ -49,6 +51,7 @@ class tinyrouter{
/**
* detect last matching route item
* if no route matches then it returns false
* @return array
*/
protected
function
_getRoute
(){
$aReturn
=
[];
...
...
@@ -124,8 +127,9 @@ class tinyrouter{
}
/**
* set incoming url
* @param string sUrl url to fetch; https://api.exaple.com/
* set incoming url, add the request behind protocol and domain.
* @param string sUrl url to fetch; /api/v1/productbyid/3424084
* @return boolean
*/
public
function
setUrl
(
$sUrl
){
$this
->
sUrl
=
$sUrl
;
...
...
@@ -138,7 +142,8 @@ class tinyrouter{
// ----------------------------------------------------------------------
/**
* helper function: get url parts as array
* helper function: get url request parts as array
* @param string $sUrl url to handle; /api/v1/productbyid/3424084
* @returns array
*/
public
function
getUrlParts
(
$sUrl
=
false
){
...
...
@@ -163,8 +168,9 @@ class tinyrouter{
}
/**
* return the callback of matching route
* @return string
* return the callback iten of the matching route
* If no route was matching it returns false
* @return {*}
*/
public
function
getCallback
(){
return
isset
(
$this
->
aMatch
[
'callback'
])
?
$this
->
aMatch
[
'callback'
]
:
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment