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
94b48870
Commit
94b48870
authored
Feb 06, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning up the auto-loader.
parent
618980c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
28 deletions
+8
-28
autoloader.php
laravel/autoloader.php
+8
-28
No files found.
laravel/autoloader.php
View file @
94b48870
...
...
@@ -102,31 +102,19 @@ class Autoloader {
*/
protected
static
function
load_psr
(
$class
,
$directory
=
null
)
{
// The PSR-0 standard indicates that class namespace slashes or
// underscores should be used to indicate the directory tree in
// which the class resides, so we'll convert the namespace
// slashes to directory slashes.
// The PSR-0 standard indicates that class namespaces and underscores
// shoould be used to indcate the directory tree in which the class
// resides, so we'll convert them to directory slashes.
$file
=
str_replace
(
array
(
'\\'
,
'_'
),
'/'
,
$class
);
if
(
is_null
(
$directory
))
{
$directories
=
static
::
$psr
;
}
else
{
$directories
=
array
(
$directory
);
}
$directories
=
$directory
?:
static
::
$psr
;
// Once we have formatted the class name, we will simply spin
// through the registered PSR-0 directories and attempt to
// locate and load the class into the script.
//
// We will check for both lowercase and CamelCase files as
// Laravel uses a lowercase version of PSR-0, while true
// PSR-0 uses CamelCase for all file names.
$lower
=
strtolower
(
$file
);
foreach
(
$directories
as
$directory
)
// Once we have formatted the class name, we'll simply spin through
// the registered PSR-0 directories and attempt to locate and load
// the class file into the script.
foreach
((
array
)
$directories
as
$directory
)
{
if
(
file_exists
(
$path
=
$directory
.
$lower
.
EXT
))
{
...
...
@@ -149,9 +137,6 @@ class Autoloader {
{
foreach
(
static
::
$namespaces
as
$namespace
=>
$directory
)
{
// If the class begins with one of the registered namespaces,
// we'll return both the namespace and the directory, which
// will allow us to use PSR-0 to load the class.
if
(
starts_with
(
$class
,
$namespace
))
{
return
compact
(
'namespace'
,
'directory'
);
...
...
@@ -162,11 +147,6 @@ class Autoloader {
/**
* Register an array of class to path mappings.
*
* <code>
* // Register a class mapping with the Autoloader
* Autoloader::map(array('User' => path('app').'models/user.php'));
* </code>
*
* @param array $mappings
* @return void
*/
...
...
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