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
a440f0e1
Commit
a440f0e1
authored
Aug 19, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modular refactoring on the configuration and module classes.
parent
d9f2ba84
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
8 deletions
+30
-8
config.php
laravel/config.php
+3
-0
laravel.php
laravel/laravel.php
+1
-1
module.php
laravel/module.php
+26
-7
No files found.
laravel/config.php
View file @
a440f0e1
...
...
@@ -46,6 +46,9 @@ class Config {
*
* // Get the SQLite database connection configuration
* $sqlite = Config::get('db.connections.sqlite');
*
* // Get a configuration item from a module configuration file
* $option = Config::get('module::file.option');
* </code>
*
* @param string $key
...
...
laravel/laravel.php
View file @
a440f0e1
...
...
@@ -44,7 +44,7 @@ define('DEFAULT_MODULE', 'application');
// --------------------------------------------------------------
// Register the active modules.
// --------------------------------------------------------------
Module
::
$modules
=
array_merge
(
array
(
'application'
=>
'application'
),
$active
);
Module
::
$modules
=
array_merge
(
array
(
'application'
),
$active
);
unset
(
$active
);
...
...
laravel/module.php
View file @
a440f0e1
...
...
@@ -5,21 +5,35 @@ class Module {
/**
* The active modules for the installation.
*
* This property is set in the Laravel bootstrap file, and the modules are defined
* by the developer in the front controller.
*
* @var array
*/
public
static
$modules
=
array
();
/**
* All of the loaded module paths.
* All of the loaded module paths keyed by name.
*
* These are stored as the module paths are determined for convenient, fast access.
*
* @var array
*/
private
static
$paths
=
array
();
/**
* Parse a modularized identifier and get the module and key.
* Parse a modularized identifier and return the module and key.
*
* Modular identifiers follow typically follow a {module}::{key} convention.
* However, for convenience, the default module does not require a module qualifier.
*
* <code>
* // Returns array('admin', 'test.example')
* Module::parse('admin::test.example');
*
* Modular identifiers follow a {module}::{key} convention.
* // Returns array('application', 'test.example')
* Module::parse('test.example');
* </code>
*
* @param string $key
* @return array
...
...
@@ -36,6 +50,10 @@ class Module {
/**
* Get the path for a given module.
*
* If the module exists in the module array as a key, that means a path other than
* the default path has been specified for the module. Otherwise, the module directory
* is assumed to have the same name as the module.
*
* @param string $module
* @return string
*/
...
...
@@ -43,7 +61,11 @@ class Module {
{
if
(
array_key_exists
(
$module
,
static
::
$paths
))
return
static
::
$paths
[
$module
];
if
(
array_key_exists
(
$module
,
static
::
$modules
))
if
(
in_array
(
$module
,
static
::
$modules
))
{
return
static
::
$paths
[
$module
]
=
MODULE_PATH
.
$module
.
'/'
;
}
elseif
(
array_key_exists
(
$module
,
static
::
$modules
))
{
return
static
::
$paths
[
$module
]
=
MODULE_PATH
.
static
::
$modules
[
$module
]
.
'/'
;
}
...
...
@@ -52,9 +74,6 @@ class Module {
/**
* Get the an array of paths to all of the modules.
*
* The module paths will be determined by the modules that are specified in the application
* modules configuration item. A trailing slash will be added to the paths.
*
* @return array
*/
public
static
function
paths
()
...
...
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