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
32391b7f
Commit
32391b7f
authored
Sep 17, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring various classes.
parent
c3f5abc3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
33 deletions
+79
-33
container.php
laravel/container.php
+19
-16
cookie.php
laravel/cookie.php
+24
-2
html.php
laravel/html.php
+15
-6
input.php
laravel/input.php
+8
-7
lang.php
laravel/lang.php
+8
-2
laravel.php
laravel/laravel.php
+5
-0
No files found.
laravel/container.php
View file @
32391b7f
...
...
@@ -13,11 +13,14 @@ class IoC {
* Get the active container instance.
*
* The container is set early in the request cycle and can be access here for
* use as a service locator if
dependency
injection is not practical.
* use as a service locator if
object
injection is not practical.
*
* <code>
* // Get the active container instance
* $container = IoC::container();
*
* // Get the active container instance and call the resolve method
* $
instance
= IoC::container()->resolve('instance');
* $
container
= IoC::container()->resolve('instance');
* </code>
*
* @return Container
...
...
@@ -73,15 +76,15 @@ class Container {
}
/**
* Register a
dependency
and its resolver.
* Register a
n object
and its resolver.
*
* The resolver function is called when the registered
dependency
is requested.
* The resolver function is called when the registered
object
is requested.
*
* <code>
* // Register a
dependency
in the container
* // Register a
n object
in the container
* IoC::register('something', function($container) {return new Something;});
*
* // Register a
dependency
in the container as a singleton
* // Register a
n object
in the container as a singleton
* IoC::register('something', function($container) {return new Something;}, true);
* </code>
*
...
...
@@ -95,7 +98,7 @@ class Container {
}
/**
* Determine if a
dependency
has been registered in the container.
* Determine if a
n object
has been registered in the container.
*
* @param string $name
* @return bool
...
...
@@ -106,13 +109,13 @@ class Container {
}
/**
* Register a
dependency
as a singleton.
* Register a
n object
as a singleton.
*
* 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
in the container as a singleton
* // Register a
n object
in the container as a singleton
* IoC::singleton('something', function($container) {return new Something;});
* </code>
*
...
...
@@ -129,13 +132,11 @@ class Container {
* Register an instance as a singleton.
*
* This method allows you to register an already existing object instance with the
* container as a singleton instance.
* container
to be managed
as a singleton instance.
*
* <code>
* // Register an instance with the IoC container
* $something = new Something;
*
* IoC::instance('something', $something);
* IoC::instance('something', new Something);
* </code>
*
* @param string $name
...
...
@@ -148,12 +149,14 @@ class Container {
}
/**
* Resolve a
dependency
.
* Resolve a
n object
.
*
* The dependency's resolver will be called and its result will be returned.
* The object's resolver will be called and its result will be returned. If the
* object is registered as a singleton and has already been resolved, the instance
* that has already been instantiated will be returned.
*
* <code>
* // Get the "something"
dependency
out of the IoC container
* // Get the "something"
object
out of the IoC container
* $something = IoC::resolve('something');
* </code>
*
...
...
laravel/cookie.php
View file @
32391b7f
...
...
@@ -9,6 +9,13 @@ class Cookie {
*/
protected
$cookies
;
/**
* The cookies that will be sent to the browser at the end of the request.
*
* @var array
*/
protected
$queue
=
array
();
/**
* Create a new cookie manager instance.
*
...
...
@@ -38,7 +45,7 @@ class Cookie {
* // Get the value of a cookie
* $value = Cookie::get('color');
*
* // Get the value of a cookie
and return "blue" if the cookie doesn't exist
* // Get the value of a cookie
or return a default value
* $value = Cookie::get('color', 'blue');
* </code>
*
...
...
@@ -99,7 +106,22 @@ class Cookie {
$time
=
(
$minutes
!=
0
)
?
time
()
+
(
$minutes
*
60
)
:
0
;
return
setcookie
(
$name
,
$value
,
$time
,
$path
,
$domain
,
$secure
,
$http_only
);
$this
->
queue
[]
=
compact
(
'name'
,
'value'
,
'time'
,
'path'
,
'domain'
,
'secure'
,
'http_only'
);
}
/**
* Send all of the cookies in the queue to the browser.
*
* This method is called automatically at the end of every request.
*
* @return void
*/
public
function
send
()
{
foreach
(
$this
->
queue
as
$cookie
)
{
call_user_func_array
(
'setcookie'
,
$cookie
);
}
}
/**
...
...
laravel/html.php
View file @
32391b7f
...
...
@@ -346,11 +346,6 @@ class HTML {
/**
* Build a list of HTML attributes from an array.
*
* <code>
* // Returns: class="profile" id="picture"
* echo HTML::attributes(array('class' => 'profile', 'id' => 'picture'));
* </code>
*
* @param array $attributes
* @return string
*/
...
...
@@ -410,6 +405,20 @@ class HTML {
* Magic Method for handling dynamic static methods.
*
* This method primarily handles dynamic calls to create links to named routes.
*
* <code>
* // Create a link to the "profile" named route
* echo HTML::link_to_profile('Profile');
*
* // Create a link to a named route with URI wildcard parameters
* echo HTML::link_to_posts('Posts', array($year, $month));
*
* // Create a HTTPS link to the "profile" named route
* echo HTML::link_to_secure_profile('Profile');
*
* // Create a HTTPS link to a named route URI wildcard parameters
* echo HTML::link_to_secure_posts('Posts', array($year, $month));
* </code>
*/
public
function
__call
(
$method
,
$parameters
)
{
...
...
laravel/input.php
View file @
32391b7f
...
...
@@ -2,6 +2,13 @@
class
Input
{
/**
* The file manager instance.
*
* @var File
*/
protected
$file
;
/**
* The applicable input for the request.
*
...
...
@@ -16,13 +23,6 @@ class Input {
*/
protected
$files
;
/**
* The file manager instance.
*
* @var File
*/
protected
$file
;
/**
* The cookie engine instance.
*
...
...
@@ -33,6 +33,7 @@ class Input {
/**
* Create a new Input manager instance.
*
* @param File $file
* @param Cookie $cookies
* @param array $input
* @param array $files
...
...
laravel/lang.php
View file @
32391b7f
...
...
@@ -41,15 +41,21 @@ class Lang_Factory {
*
* // Begin retrieving a language line with replacements
* $lang = Lang::line('validation.required', array('attribute' => 'email'));
*
* // Begin retrieving a language line in a given language
* $lang = Lang::line('messages.welcome', null, 'sp');
* </code>
*
* @param string $key
* @param array $replacements
* @param string $language
* @return Lang
*/
public
function
line
(
$key
,
$replacements
=
array
())
public
function
line
(
$key
,
$replacements
=
array
()
,
$language
=
null
)
{
return
new
Lang
(
$key
,
$replacements
,
$this
->
config
->
get
(
'application.language'
),
$this
->
paths
);
$language
=
(
!
is_null
(
$language
))
$this
->
config
->
get
(
'application.language'
)
:
$language
;
return
new
Lang
(
$key
,
(
array
)
$replacements
,
$language
,
$this
->
paths
);
}
}
...
...
laravel/laravel.php
View file @
32391b7f
...
...
@@ -81,6 +81,11 @@ if (isset($session))
$session
->
close
(
$container
->
resolve
(
'laravel.session'
),
$config
->
get
(
'session'
));
}
// --------------------------------------------------------------
// Send the queued cookies to the browser.
// --------------------------------------------------------------
$container
->
resolve
(
'laravel.cookie'
)
->
send
();
// --------------------------------------------------------------
// Send the response to the browser.
// --------------------------------------------------------------
...
...
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