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
9c9b6eed
Commit
9c9b6eed
authored
Apr 07, 2013
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
5ddeab60
0008a232
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
110 additions
and
24 deletions
+110
-24
file.php
laravel/cache/drivers/file.php
+11
-1
redis.php
laravel/cache/drivers/redis.php
+6
-6
artisan.php
laravel/cli/artisan.php
+3
-2
model.php
laravel/database/eloquent/model.php
+2
-2
table.php
laravel/database/schema/table.php
+38
-1
ioc.md
laravel/documentation/ioc.md
+10
-1
helpers.php
laravel/helpers.php
+8
-8
ioc.php
laravel/ioc.php
+18
-3
ioc.test.php
laravel/tests/cases/ioc.test.php
+14
-0
No files found.
laravel/cache/drivers/file.php
View file @
9c9b6eed
...
...
@@ -97,4 +97,14 @@ class File extends Driver {
if
(
file_exists
(
$this
->
path
.
$key
))
@
unlink
(
$this
->
path
.
$key
);
}
/**
* Flush the entire cache.
*
* @return void
*/
public
function
flush
()
{
array_map
(
'unlink'
,
glob
(
$this
->
path
.
'*'
));
}
}
laravel/cache/drivers/redis.php
View file @
9c9b6eed
laravel/cli/artisan.php
View file @
9c9b6eed
...
...
@@ -43,7 +43,8 @@ try
}
catch
(
\Exception
$e
)
{
echo
$e
->
getMessage
();
echo
$e
->
getMessage
()
.
PHP_EOL
;
exit
(
1
);
}
echo
PHP_EOL
;
laravel/database/eloquent/model.php
View file @
9c9b6eed
...
...
@@ -517,7 +517,7 @@ abstract class Model {
foreach
(
$this
->
attributes
as
$key
=>
$value
)
{
if
(
!
array_key_exists
(
$key
,
$this
->
original
)
or
$value
!=
$this
->
original
[
$key
])
if
(
!
array_key_exists
(
$key
,
$this
->
original
)
or
$value
!=
=
$this
->
original
[
$key
])
{
$dirty
[
$key
]
=
$value
;
}
...
...
laravel/database/schema/table.php
View file @
9c9b6eed
...
...
@@ -39,6 +39,25 @@ class Table {
*/
public
$commands
=
array
();
/**
* The registered custom macros.
*
* @var array
*/
public
static
$macros
=
array
();
/**
* Registers a custom macro.
*
* @param string $name
* @param Closure $macro
* @return void
*/
public
static
function
macro
(
$name
,
$macro
)
{
static
::
$macros
[
$name
]
=
$macro
;
}
/**
* Create a new schema table instance.
*
...
...
@@ -422,4 +441,22 @@ class Table {
return
$this
->
columns
[]
=
new
Fluent
(
$parameters
);
}
/**
* Dynamically handle calls to custom macros.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public
function
__call
(
$method
,
$parameters
)
{
if
(
isset
(
static
::
$macros
[
$method
]))
{
array_unshift
(
$parameters
,
$this
);
return
call_user_func_array
(
static
::
$macros
[
$method
],
$parameters
);
}
throw
new
\Exception
(
"Method [
$method
] does not exist."
);
}
}
laravel/documentation/ioc.md
View file @
9c9b6eed
...
...
@@ -47,3 +47,12 @@ Now that we have SwiftMailer registered in the container, we can resolve it usin
$mailer = IoC::resolve('mailer');
> **Note:** You may also [register controllers in the container](/docs/controllers#dependency-injection).
<a
name=
"unregister"
></a>
## Unregister an existing instance
For test purposes sometimes you need to unregister some container.
#### Unregister example mail class:
IoC::unregister('mailer');
\ No newline at end of file
laravel/helpers.php
View file @
9c9b6eed
...
...
@@ -328,7 +328,7 @@ function head($array)
*/
function
url
(
$url
=
''
,
$https
=
null
)
{
return
Laravel\
URL
::
to
(
$url
,
$https
);
return
URL
::
to
(
$url
,
$https
);
}
/**
...
...
@@ -340,7 +340,7 @@ function url($url = '', $https = null)
*/
function
asset
(
$url
,
$https
=
null
)
{
return
Laravel\
URL
::
to_asset
(
$url
,
$https
);
return
URL
::
to_asset
(
$url
,
$https
);
}
/**
...
...
@@ -360,7 +360,7 @@ function asset($url, $https = null)
*/
function
action
(
$action
,
$parameters
=
array
())
{
return
Laravel\
URL
::
to_action
(
$action
,
$parameters
);
return
URL
::
to_action
(
$action
,
$parameters
);
}
/**
...
...
@@ -380,7 +380,7 @@ function action($action, $parameters = array())
*/
function
route
(
$name
,
$parameters
=
array
())
{
return
Laravel\
URL
::
to_route
(
$name
,
$parameters
);
return
URL
::
to_route
(
$name
,
$parameters
);
}
/**
...
...
@@ -523,7 +523,7 @@ function view($view, $data = array())
{
if
(
is_null
(
$view
))
return
''
;
return
Laravel\
View
::
make
(
$view
,
$data
);
return
View
::
make
(
$view
,
$data
);
}
/**
...
...
@@ -537,7 +537,7 @@ function render($view, $data = array())
{
if
(
is_null
(
$view
))
return
''
;
return
Laravel\
View
::
make
(
$view
,
$data
)
->
render
();
return
View
::
make
(
$view
,
$data
)
->
render
();
}
/**
...
...
@@ -551,7 +551,7 @@ function render($view, $data = array())
*/
function
render_each
(
$partial
,
array
$data
,
$iterator
,
$empty
=
'raw|'
)
{
return
Laravel\
View
::
render_each
(
$partial
,
$data
,
$iterator
,
$empty
);
return
View
::
render_each
(
$partial
,
$data
,
$iterator
,
$empty
);
}
/**
...
...
@@ -562,7 +562,7 @@ function render_each($partial, array $data, $iterator, $empty = 'raw|')
*/
function
yield
(
$section
)
{
return
Laravel\
Section
::
yield
(
$section
);
return
Section
::
yield
(
$section
);
}
/**
...
...
laravel/ioc.php
View file @
9c9b6eed
...
...
@@ -31,6 +31,19 @@ class IoC {
static
::
$registry
[
$name
]
=
compact
(
'resolver'
,
'singleton'
);
}
/**
* Unregister an object
*
* @param string $name
*/
public
static
function
unregister
(
$name
)
{
if
(
array_key_exists
(
$name
,
static
::
$registry
))
{
unset
(
static
::
$registry
[
$name
]);
unset
(
static
::
$singletons
[
$name
]);
}
}
/**
* Determine if an object has been registered in the container.
*
...
...
@@ -141,6 +154,7 @@ class IoC {
* @param string $type
* @param array $parameters
* @return mixed
* @throws \Exception
*/
protected
static
function
build
(
$type
,
$parameters
=
array
())
{
...
...
@@ -218,6 +232,7 @@ class IoC {
*
* @param ReflectionParameter
* @return default value
* @throws \Exception
*/
protected
static
function
resolveNonClass
(
$parameter
)
{
...
...
laravel/tests/cases/ioc.test.php
View file @
9c9b6eed
...
...
@@ -28,6 +28,7 @@ class TestClassTwoForIoC
}
}
use
\Laravel\IoC
as
IoC
;
class
IoCTest
extends
PHPUnit_Framework_TestCase
{
...
...
@@ -150,4 +151,17 @@ class IoCTest extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
42
,
$class_two
->
class_one
->
test_variable
);
}
public
function
testCanUnregisterRegistered
()
{
$testClass
=
'test'
;
IoC
::
register
(
$testClass
,
function
()
{});
$this
->
assertTrue
(
IoC
::
registered
(
$testClass
));
IoC
::
unregister
(
$testClass
);
$this
->
assertFalse
(
IoC
::
registered
(
$testClass
));
}
}
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