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
ad3f98db
Commit
ad3f98db
authored
Jun 17, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve comments in Route\Finder.
parent
7ce9c6f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
finder.php
system/route/finder.php
+7
-15
No files found.
system/route/finder.php
View file @
ad3f98db
...
...
@@ -24,31 +24,23 @@ class Finder {
*/
public
static
function
find
(
$name
)
{
// --------------------------------------------------------------
// Load the routes if we haven't already.
// --------------------------------------------------------------
if
(
is_null
(
static
::
$routes
))
{
static
::
$routes
=
(
is_dir
(
APP_PATH
.
'routes'
))
?
static
::
load
()
:
require
APP_PATH
.
'routes'
.
EXT
;
}
// --------------------------------------------------------------
// Have we already located this route by name?
// --------------------------------------------------------------
if
(
array_key_exists
(
$name
,
static
::
$names
))
{
return
static
::
$names
[
$name
];
}
// --------------------------------------------------------------
// Instantiate the SPL array iterators.
// --------------------------------------------------------------
// ---------------------------------------------------------
// We haven't located the route before, so we'll need to
// iterate through each route to find the matching name.
// ---------------------------------------------------------
$arrayIterator
=
new
\RecursiveArrayIterator
(
static
::
$routes
);
$recursiveIterator
=
new
\RecursiveIteratorIterator
(
$arrayIterator
);
// --------------------------------------------------------------
// Iterate over the routes and find the named route.
// --------------------------------------------------------------
foreach
(
$recursiveIterator
as
$iterator
)
{
$route
=
$recursiveIterator
->
getSubIterator
();
...
...
@@ -63,15 +55,15 @@ class Finder {
/**
* Load all of the routes from the routes directory.
*
* All of the various route files will be merged together
* into a single array that can be searched.
*
* @return array
*/
private
static
function
load
()
{
$routes
=
array
();
// --------------------------------------------------------------
// Merge all of the various route files together.
// --------------------------------------------------------------
foreach
(
glob
(
APP_PATH
.
'routes/*'
)
as
$file
)
{
if
(
filetype
(
$file
)
==
'file'
)
...
...
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