Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
220c359e
Commit
220c359e
authored
Sep 16, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed changes.
parent
77dc8d20
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
96 additions
and
6 deletions
+96
-6
application/config/aliases.php
+0
-0
application/config/application.php
+0
-0
application/config/auth.php
+0
-0
application/config/cache.php
+0
-0
application/config/database.php
+0
-0
application/config/error.php
+0
-0
application/config/session.php
+0
-0
laravel/bootstrap.php
+0
-0
laravel/config.php
+96
-6
laravel/config/container.php
+0
-0
No files found.
application/config/aliases.php
View file @
220c359e
application/config/application.php
View file @
220c359e
application/config/auth.php
View file @
220c359e
application/config/cache.php
View file @
220c359e
application/config/database.php
View file @
220c359e
application/config/error.php
View file @
220c359e
application/config/session.php
View file @
220c359e
laravel/bootstrap.php
View file @
220c359e
laravel/config.php
View file @
220c359e
...
@@ -5,19 +5,28 @@ class Config {
...
@@ -5,19 +5,28 @@ class Config {
/**
/**
* All of the loaded configuration items.
* All of the loaded configuration items.
*
*
* The configuration arrays are keyed by their owning file name.
*
* @var array
* @var array
*/
*/
protected
$config
=
array
();
protected
$items
=
array
();
/**
* The paths to the configuration files.
*
* @var array
*/
protected
$paths
=
array
();
/**
/**
* Create a new configuration manager instance.
* Create a new configuration manager instance.
*
*
* @param array $
config
* @param array $
paths
* @return void
* @return void
*/
*/
public
function
__construct
(
$
config
)
public
function
__construct
(
$
paths
)
{
{
$this
->
config
=
$config
;
$this
->
paths
=
$paths
;
}
}
/**
/**
...
@@ -67,7 +76,19 @@ class Config {
...
@@ -67,7 +76,19 @@ class Config {
*/
*/
public
function
get
(
$key
,
$default
=
null
)
public
function
get
(
$key
,
$default
=
null
)
{
{
return
Arr
::
get
(
$this
->
items
,
$key
,
$default
);
list
(
$file
,
$key
)
=
$this
->
parse
(
$key
);
if
(
!
$this
->
load
(
$file
))
{
return
(
$default
instanceof
\Closure
)
?
call_user_func
(
$default
)
:
$default
;
}
if
(
is_null
(
$key
))
{
return
$this
->
items
[
$file
];
}
return
Arr
::
get
(
$this
->
items
[
$file
],
$key
,
$default
);
}
}
/**
/**
...
@@ -94,7 +115,75 @@ class Config {
...
@@ -94,7 +115,75 @@ class Config {
*/
*/
public
function
set
(
$key
,
$value
)
public
function
set
(
$key
,
$value
)
{
{
Arr
::
set
(
$this
->
items
,
$key
,
$value
);
list
(
$file
,
$key
)
=
$this
->
parse
(
$key
);
$this
->
load
(
$file
);
if
(
is_null
(
$key
))
{
Arr
::
set
(
$this
->
items
,
$file
,
$value
);
}
else
{
Arr
::
set
(
$this
->
items
[
$file
],
$key
,
$value
);
}
}
/**
* Parse a configuration key and return its file and key segments.
*
* Configuration keys follow a {file}.{key} convention. So, for example, the
* "session.driver" option refers to the "driver" option within the "session"
* configuration file.
*
* If no specific item is specified, such as when requested "session", null will
* be returned as the value of the key since the entire file is being requested.
*
* @param string $key
* @return array
*/
protected
function
parse
(
$key
)
{
$segments
=
explode
(
'.'
,
$key
);
$key
=
(
count
(
$segments
)
>
1
)
?
implode
(
'.'
,
array_slice
(
$segments
,
1
))
:
null
;
return
array
(
$segments
[
0
],
$key
);
}
/**
* Load all of the configuration items from a module configuration file.
*
* If the configuration file has already been loaded into the items array, there
* is no need to load it again, so "true" will be returned immediately.
*
* Configuration files cascade across directories. So, for example, if a configuration
* file is in the system directory, its options will be overriden by a matching file
* in the application directory.
*
* @param string $file
* @return bool
*/
protected
function
load
(
$file
)
{
if
(
isset
(
$this
->
items
[
$file
]))
return
true
;
$config
=
array
();
foreach
(
$this
->
paths
as
$directory
)
{
if
(
file_exists
(
$path
=
$directory
.
$file
.
EXT
))
{
$config
=
array_merge
(
$config
,
require
$path
);
}
}
if
(
count
(
$config
)
>
0
)
{
$this
->
items
[
$file
]
=
$config
;
}
return
isset
(
$this
->
items
[
$file
]);
}
}
}
}
\ No newline at end of file
laravel/config/container.php
View file @
220c359e
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