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
f5680e45
Commit
f5680e45
authored
Oct 30, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverting facade changes.
parent
932a70b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
63 deletions
+0
-63
facades.php
laravel/facades.php
+0
-63
No files found.
laravel/facades.php
deleted
100644 → 0
View file @
932a70b6
<?php
namespace
Laravel\Facades
;
use
Laravel\IoC
;
/**
* The Laravel framework makes thorough use of dependency injection assisted by an application
* inversion of control container. This allows for great flexibility, easy testing, and better
* architecture. However, most PHP framework users may be used to accessing classes through
* a variety of static methods. Laravel provides "facades" to simulate this behavior while
* still using heavy dependency injection.
*
* Each class that is commonly used by the developer has a corresponding facade defined in
* this file. All of the various facades inherit from the abstract Facade class, which only
* has a single __callStatic magic method. The facade simply resolves the requested class
* out of the IoC container and calls the appropriate method.
*/
abstract
class
Facade
{
/**
* Magic Method for passing methods to a class registered in the IoC container.
* This provides a convenient method of accessing functions on classes that
* could not otherwise be accessed staticly.
*
* Facades allow Laravel to still have a high level of dependency injection
* and testability while still accomodating the common desire to conveniently
* use classes via static methods.
*/
public
static
function
__callStatic
(
$method
,
$parameters
)
{
$class
=
IoC
::
container
()
->
resolve
(
static
::
$resolve
);
$count
=
count
(
$parameters
);
if
(
$count
>
5
)
{
return
call_user_func_array
(
array
(
$class
,
$method
),
$parameters
);
}
elseif
(
$count
==
1
)
{
return
$class
->
$method
(
$parameters
[
0
]);
}
elseif
(
$count
==
2
)
{
return
$class
->
$method
(
$parameters
[
0
],
$parameters
[
1
]);
}
elseif
(
$count
==
3
)
{
return
$class
->
$method
(
$parameters
[
0
],
$parameters
[
1
],
$parameters
[
2
]);
}
elseif
(
$count
==
4
)
{
return
$class
->
$method
(
$parameters
[
0
],
$parameters
[
1
],
$parameters
[
2
],
$parameters
[
3
]);
}
elseif
(
$count
==
5
)
{
return
$class
->
$method
(
$parameters
[
0
],
$parameters
[
1
],
$parameters
[
2
],
$parameters
[
3
],
$parameters
[
4
]);
}
}
}
class
Input
extends
Facade
{
public
static
$resolve
=
'laravel.input'
;
}
class
Request
extends
Facade
{
public
static
$resolve
=
'laravel.request'
;
}
\ No newline at end of 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