Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3e2bcfdf
Commit
3e2bcfdf
authored
Oct 19, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored Module::setBasePath to remove instanceof condition
parent
e8eccc28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
Application.php
framework/yii/base/Application.php
+12
-0
Module.php
framework/yii/base/Module.php
+0
-3
No files found.
framework/yii/base/Application.php
View file @
3e2bcfdf
...
...
@@ -222,6 +222,18 @@ abstract class Application extends Module
}
/**
* Sets the root directory of the applicaition and the @app alias.
* This method can only be invoked at the beginning of the constructor.
* @param string $path the root directory of the application.
* @throws InvalidParamException if the directory does not exist.
*/
public
function
setBasePath
(
$path
)
{
parent
::
setBasePath
(
$path
);
Yii
::
setAlias
(
'@app'
,
$this
->
getBasePath
());
}
/**
* Runs the application.
* This is the main entrance of an application.
* @return integer the exit status (0 means normal, non-zero values mean abnormal)
...
...
framework/yii/base/Module.php
View file @
3e2bcfdf
...
...
@@ -217,9 +217,6 @@ abstract class Module extends Component
$p
=
realpath
(
$path
);
if
(
$p
!==
false
&&
is_dir
(
$p
))
{
$this
->
_basePath
=
$p
;
if
(
$this
instanceof
Application
)
{
Yii
::
setAlias
(
'@app'
,
$p
);
}
}
else
{
throw
new
InvalidParamException
(
"The directory does not exist:
$path
"
);
}
...
...
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