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
bc1a7d07
Commit
bc1a7d07
authored
Feb 06, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improving namespace autoloading support.
parent
5b6b156b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
autoloader.php
laravel/autoloader.php
+18
-3
No files found.
laravel/autoloader.php
View file @
bc1a7d07
...
@@ -64,10 +64,8 @@ class Autoloader {
...
@@ -64,10 +64,8 @@ class Autoloader {
// using the PSR-0 standards from that directory; however, we will trim
// using the PSR-0 standards from that directory; however, we will trim
// off the beginning of the namespace to account for files in the root
// off the beginning of the namespace to account for files in the root
// of the mapped directory.
// of the mapped directory.
if
(
isset
(
static
::
$namespaces
[
$namespace
]
))
if
(
!
is_null
(
$directory
=
static
::
directory
(
$class
)
))
{
{
$directory
=
static
::
$namespaces
[
$namespace
];
return
static
::
load_psr
(
substr
(
$class
,
$slash
+
1
),
$directory
);
return
static
::
load_psr
(
substr
(
$class
,
$slash
+
1
),
$directory
);
}
}
...
@@ -93,6 +91,23 @@ class Autoloader {
...
@@ -93,6 +91,23 @@ class Autoloader {
static
::
load_psr
(
$class
);
static
::
load_psr
(
$class
);
}
}
/**
* Get the directory associated with a given namespaced class.
*
* @param string $class
* @return string
*/
protected
static
function
directory
(
$class
)
{
foreach
(
static
::
$namespaces
as
$namespace
=>
$directory
)
{
if
(
starts_with
(
$class
,
$namespace
))
{
return
$directory
;
}
}
}
/**
/**
* Attempt to resolve a class using the PSR-0 standard.
* Attempt to resolve a class using the PSR-0 standard.
*
*
...
...
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