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
58ca27a4
Commit
58ca27a4
authored
May 23, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored console Request.
parent
ef192eb4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
Request.php
framework/yii/console/Request.php
+26
-5
No files found.
framework/yii/console/Request.php
View file @
58ca27a4
...
...
@@ -15,9 +15,32 @@ class Request extends \yii\base\Request
{
const
ANONYMOUS_PARAMS
=
'-args'
;
public
function
getRawParams
()
private
$_params
;
/**
* Returns the command line arguments.
* @return array the command line arguments. It does not include the entry script name.
*/
public
function
getParams
()
{
if
(
!
isset
(
$this
->
_params
))
{
if
(
isset
(
$_SERVER
[
'argv'
]))
{
$this
->
_params
=
$_SERVER
[
'argv'
];
array_shift
(
$this
->
_params
);
}
else
{
$this
->
_params
=
array
();
}
}
return
$this
->
_params
;
}
/**
* Sets the command line arguments.
* @param array $params the command line arguments
*/
public
function
setParams
(
$params
)
{
return
isset
(
$_SERVER
[
'argv'
])
?
$_SERVER
[
'argv'
]
:
array
()
;
$this
->
_params
=
$params
;
}
/**
...
...
@@ -26,9 +49,7 @@ class Request extends \yii\base\Request
*/
public
function
resolve
()
{
$rawParams
=
$this
->
getRawParams
();
array_shift
(
$rawParams
);
// the 1st argument is the yii script name
$rawParams
=
$this
->
getParams
();
if
(
isset
(
$rawParams
[
0
]))
{
$route
=
$rawParams
[
0
];
array_shift
(
$rawParams
);
...
...
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