Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
396d1487
Commit
396d1487
authored
Jun 18, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added is method, improved comments.
parent
c972fe19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
request.php
system/request.php
+27
-11
No files found.
system/request.php
View file @
396d1487
...
...
@@ -2,6 +2,13 @@
class
Request
{
/**
* The request URI.
*
* @var string
*/
private
static
$uri
;
/**
* Get the request URI.
*
...
...
@@ -9,8 +16,13 @@ class Request {
*/
public
static
function
uri
()
{
if
(
!
is_null
(
static
::
$uri
))
{
return
static
::
$uri
;
}
// -------------------------------------------------------
//
If the PATH_INFO is available, use it
.
//
Use the PATH_INFO variable if it is available
.
// -------------------------------------------------------
if
(
isset
(
$_SERVER
[
'PATH_INFO'
]))
{
...
...
@@ -28,9 +40,6 @@ class Request {
throw
new
\Exception
(
"Malformed request URI. Request terminated."
);
}
}
// -------------------------------------------------------
// Neither PATH_INFO or REQUEST_URI are available.
// -------------------------------------------------------
else
{
throw
new
\Exception
(
'Unable to determine the request URI.'
);
...
...
@@ -59,21 +68,28 @@ class Request {
}
/**
* Check the
request URI
.
* Check the
URI against a string or set of strings
.
*
* @param mixed $uri
* @return bool
*/
public
static
function
is
(
$uri
)
public
static
function
is
()
{
if
(
is_array
(
$uri
))
$parameters
=
func_get_args
();
// -------------------------------------------------------
// If any of the parameters match the URI, return true.
// -------------------------------------------------------
if
(
count
(
$parameters
)
>
1
)
{
return
(
in_array
(
static
::
uri
(),
$uri
))
?
true
:
false
;
return
in_array
(
static
::
uri
(),
$parameters
)
;
}
else
if
(
count
(
$parameters
)
===
1
)
{
return
(
static
::
uri
()
==
$uri
)
?
true
:
false
;
return
static
::
uri
()
==
$parameters
[
0
]
;
}
return
false
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment