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
f113b5c8
Commit
f113b5c8
authored
Aug 30, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring for dependency injection.
parent
8229891d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
23 additions
and
153 deletions
+23
-153
arr.php
laravel/arr.php
+0
-10
config.php
laravel/config.php
+0
-24
container.php
laravel/config/container.php
+2
-2
container.php
laravel/container.php
+0
-33
controller.php
laravel/controller.php
+1
-3
file.php
laravel/file.php
+1
-14
input.php
laravel/input.php
+0
-26
lang.php
laravel/lang.php
+0
-18
redirect.php
laravel/redirect.php
+19
-3
response.php
laravel/response.php
+0
-10
view.php
laravel/view.php
+0
-10
No files found.
laravel/arr.php
View file @
f113b5c8
...
...
@@ -9,11 +9,6 @@ class Arr {
* also be accessed using JavaScript "dot" style notation. Retrieving items nested
* in multiple arrays is also supported.
*
* <code>
* // Returns "taylor"
* Arr::get(array('name' => array('is' => 'Taylor')), 'name.is');
* </code>
*
* @param array $array
* @param string $key
* @param mixed $default
...
...
@@ -47,11 +42,6 @@ class Arr {
*
* Like the Arr::get method, JavaScript "dot" syntax is supported.
*
* <code>
* // Set "name.is" to "taylor"
* Arr::set(array('name' => array('is' => 'something')), 'name.is', 'taylor');
* </code>
*
* @param array $array
* @param string $key
* @param mixed $value
...
...
laravel/config.php
View file @
f113b5c8
...
...
@@ -14,14 +14,6 @@ class Config {
/**
* Determine if a configuration item or file exists.
*
* <code>
* // Determine if the "session" configuration file exists
* Config::has('session');
*
* // Determine if the application timezone option exists
* Config::has('application.timezone');
* </code>
*
* @param string $key
* @return bool
*/
...
...
@@ -40,14 +32,6 @@ class Config {
* If the name of a configuration file is passed without specifying an item, the
* entire configuration array will be returned.
*
* <code>
* // Get the timezone option from the application configuration file
* $timezone = Config::get('application.timezone');
*
* // Get the SQLite database connection configuration
* $sqlite = Config::get('database.connections.sqlite');
* </code>
*
* @param string $key
* @param string $default
* @return array
...
...
@@ -75,14 +59,6 @@ class Config {
* If a specific configuration item is not specified, the entire configuration
* array will be replaced with the given value.
*
* <code>
* // Set the timezone option in the application configuration file
* Config::set('application.timezone', 'America/Chicago');
*
* // Set the session configuration array
* Config::set('session', array());
* </code>
*
* @param string $key
* @param mixed $value
* @return void
...
...
laravel/config/container.php
View file @
f113b5c8
...
...
@@ -4,7 +4,7 @@ return array(
/*
|--------------------------------------------------------------------------
| Laravel
Support
Components
| Laravel Components
|--------------------------------------------------------------------------
*/
...
...
@@ -59,7 +59,7 @@ return array(
'laravel.redirect'
=>
array
(
'singleton'
=>
true
,
'resolver'
=>
function
(
$container
)
{
return
new
Redirect
(
$container
->
resolve
(
'laravel.url'
));
return
new
Redirect
(
$container
->
resolve
(
'laravel.
session.driver'
),
$container
->
resolve
(
'laravel.
url'
));
}),
...
...
laravel/container.php
View file @
f113b5c8
...
...
@@ -21,11 +21,6 @@ class IoC {
/**
* Magic Method for calling methods on the active container instance.
*
* <code>
* // Get the request registered in the container
* $request = IoC::resolve('laravel.request');
* </code>
*/
public
static
function
__callStatic
(
$method
,
$parameters
)
{
...
...
@@ -69,14 +64,6 @@ class Container {
*
* The resolver function when the registered dependency is requested.
*
* <code>
* // Register a simple dependency
* $container->register('name', function() { return 'Fred'; });
*
* // Register a dependency as a singleton
* $container->register('name', function() { return new Name; }, true);
* </code>
*
* @param string $name
* @param Closure $resolver
* @return void
...
...
@@ -89,11 +76,6 @@ class Container {
/**
* Determine if a dependency has been registered in the container.
*
* <code>
* // Determine if the "user" dependency is registered in the container
* $registered = $container->registered('user');
* </code>
*
* @param string $name
* @return bool
*/
...
...
@@ -108,11 +90,6 @@ class Container {
* Singletons will only be instantiated the first time they are resolved. On subsequent
* requests for the object, the original instance will be returned.
*
* <code>
* // Register a dependency as a singleton
* $container->singleton('user', function() { return new User; })
* </code>
*
* @param string $name
* @param Closure $resolver
* @return void
...
...
@@ -128,11 +105,6 @@ class Container {
* This method allows you to register an already existing object instance with the
* container as a singleton instance.
*
* <code>
* // Register an object instance as a singleton in the container
* $container->instance('user', new User);
* </code>
*
* @param string $name
* @param mixed $instance
* @return void
...
...
@@ -147,11 +119,6 @@ class Container {
*
* The dependency's resolver will be called and its result will be returned.
*
* <code>
* // Resolver the "name" dependency
* $name = $container->resolve('name');
* </code>
*
* @param string $name
* @return mixed
*/
...
...
laravel/controller.php
View file @
f113b5c8
...
...
@@ -17,9 +17,7 @@ abstract class Controller {
*/
public
function
__get
(
$key
)
{
$application
=
IoC
::
resolve
(
'laravel.application'
);
return
$application
->
$key
;
return
IoC
::
resolve
(
'laravel.application'
)
->
$key
;
}
/**
...
...
laravel/file.php
View file @
f113b5c8
...
...
@@ -124,13 +124,6 @@ class File {
/**
* Get a file MIME type by extension.
*
* Any extension in the MIMEs configuration file may be passed to the method.
*
* <code>
* // Returns "application/x-tar"
* $mime = $file->mime('tar');
* </code>
*
* @param string $extension
* @param string $default
* @return string
...
...
@@ -145,13 +138,7 @@ class File {
/**
* Determine if a file is a given type.
*
* The Fileinfo PHP extension will be used to determine the MIME type of the file. Any extension
* in the MIMEs configuration file may be passed as a type.
*
* <code>
* // Determine if the file is a JPG image
* $image = $file->is('jpg', 'path/to/image.jpg');
* </code>
* The Fileinfo PHP extension will be used to determine the MIME type of the file.
*
* @param string $extension
* @param string $path
...
...
laravel/input.php
View file @
f113b5c8
...
...
@@ -80,14 +80,6 @@ class Input {
*
* This method should be used for all request methods (GET, POST, PUT, and DELETE).
*
* <code>
* // Get the "name" item from the input data
* $name = Request::active()->input->get('name');
*
* // Get the "name" item and return "Fred" if it doesn't exist.
* $name = Request::active()->input->get('name', 'Fred');
* </code>
*
* @param string $key
* @param mixed $default
* @return string
...
...
@@ -111,11 +103,6 @@ class Input {
/**
* Get input data from the previous request.
*
* <code>
* // Get the "name" item from the old input data
* $name = Request::active()->input->old('name');
* </code>
*
* @param string $key
* @param mixed $default
* @return string
...
...
@@ -132,14 +119,6 @@ class Input {
*
* "Dot" syntax may be used to get a specific item from the file array.
*
* <code>
* // Get the array of information regarding a given file
* $file = Request::active()->input->file('picture');
*
* // Get the size of a given file
* $file = Request::active()->input->file('picture.size');
* </code>
*
* @param string $key
* @param mixed $default
* @return array
...
...
@@ -165,11 +144,6 @@ class Input {
/**
* Magic Method for retrieving items from the request input.
*
* <code>
* // Retrieve the "name" item from the input data
* $name = Request::active()->input->name;
* </code>
*/
public
function
__get
(
$key
)
{
...
...
laravel/lang.php
View file @
f113b5c8
...
...
@@ -52,14 +52,6 @@ class Lang {
* Language lines are retrieved using "dot" notation. So, asking for the "messages.required" langauge
* line would return the "required" line from the "messages" language file.
*
* <code>
* // Get the "required" line from the "validation" language file
* $line = Lang::line('validation.required')->get();
*
* // Specify a replacement for a language line
* $line = Lang::line('welcome.message', array('name' => 'Fred'))->get();
* </code>
*
* @param string $key
* @param array $replacements
* @return Lang
...
...
@@ -74,11 +66,6 @@ class Lang {
*
* A default value may also be specified, which will be returned in the language line doesn't exist.
*
* <code>
* // Get a validation line and return a default value if the line doesn't exist
* $line = Lang::line('welcome.message')->get('Hello!');
* </code>
*
* @param string $language
* @return string
*/
...
...
@@ -156,11 +143,6 @@ class Lang {
*
* The language specified in this method should correspond to a language directory in your application.
*
* <code>
* // Get a "fr" language line
* $line = Lang::line('validation.required')->in('fr')->get();
* </code>
*
* @param string $language
* @return Lang
*/
...
...
laravel/redirect.php
View file @
f113b5c8
...
...
@@ -2,15 +2,31 @@
class
Redirect
extends
Response
{
/**
* The URL generator instance.
*
* @var URL
*/
private
$url
;
/**
* The active session driver instance.
*
* @var Session\Driver
*/
private
$session
;
/**
* Create a new redirect generator instance.
*
* @param URL $url
* @param Session\Driver $session
* @param URL $url
* @return void
*/
public
function
__construct
(
URL
$url
)
public
function
__construct
(
Session\Driver
$session
,
URL
$url
)
{
$this
->
url
=
$url
;
$this
->
session
=
$session
;
}
/**
...
...
@@ -62,7 +78,7 @@ class Redirect extends Response {
*/
public
function
with
(
$key
,
$value
)
{
IoC
::
container
()
->
resolve
(
'laravel.session.driver'
)
->
flash
(
$key
,
$value
);
$this
->
session
->
flash
(
$key
,
$value
);
return
$this
;
}
...
...
laravel/response.php
View file @
f113b5c8
...
...
@@ -223,14 +223,4 @@ class Response {
return
$this
;
}
/**
* Magic Method for passing undefined static methods to the Response_Factory instance
* registered in the application IoC container. This provides easy access to the
* response functions while still maintaining testability within the classes.
*/
public
static
function
__callStatic
(
$method
,
$parameters
)
{
return
call_user_func_array
(
array
(
IoC
::
container
()
->
resolve
(
'laravel.response'
),
$method
),
$parameters
);
}
}
\ No newline at end of file
laravel/view.php
View file @
f113b5c8
...
...
@@ -296,14 +296,4 @@ class View {
unset
(
$this
->
data
[
$key
]);
}
/**
* Magic Method for passing undefined static methods to the View_Factory instance
* registered in the application IoC container. This provides easy access to the
* view functions while still maintaining testability within the view classes.
*/
public
static
function
__callStatic
(
$method
,
$parameters
)
{
return
call_user_func_array
(
array
(
IoC
::
container
()
->
resolve
(
'laravel.view'
),
$method
),
$parameters
);
}
}
\ 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