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
b262e743
Commit
b262e743
authored
Feb 20, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autoload bundles based on namespace.
parent
106b5dc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
autoloader.php
laravel/autoloader.php
+15
-0
helpers.php
laravel/helpers.php
+14
-0
No files found.
laravel/autoloader.php
View file @
b262e743
...
...
@@ -67,6 +67,21 @@ class Autoloader {
return
static
::
load_psr
(
$class
,
$info
[
'directory'
]);
}
// If the class is namespaced and a bundle exists that is assigned
// a name matching that namespace, we'll start the bundle and let
// the class fall through the method again.
if
(
!
is_null
(
$namespace
=
root_namespace
(
$class
)))
{
$namespace
=
strtolower
(
$namespace
);
if
(
Bundle
::
exists
(
$namespace
)
and
!
Bundle
::
started
(
$namespace
))
{
Bundle
::
start
(
$namespace
);
return
static
::
load
(
$class
);
}
}
// If the class is not maped and is not part of a bundle or a mapped
// namespace, we'll make a last ditch effort to load the class via
// the PSR-0 from one of the registered directories.
...
...
laravel/helpers.php
View file @
b262e743
...
...
@@ -361,6 +361,20 @@ function str_finish($value, $cap)
return
rtrim
(
$value
,
$cap
)
.
$cap
;
}
/**
* Get the root namespace of a given class.
*
* @param string $class
* @return string
*/
function
root_namespace
(
$class
)
{
if
(
str_contains
(
$class
,
'\\'
))
{
return
head
(
explode
(
'\\'
,
$class
));
}
}
/**
* Return the value of the given item.
*
...
...
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