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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
3959b8db
Commit
3959b8db
authored
Nov 19, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test break.
parent
726a305b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
BaseArrayHelper.php
framework/yii/helpers/BaseArrayHelper.php
+7
-7
No files found.
framework/yii/helpers/BaseArrayHelper.php
View file @
3959b8db
...
@@ -333,8 +333,8 @@ class BaseArrayHelper
...
@@ -333,8 +333,8 @@ class BaseArrayHelper
* elements, a property name of the objects, or an anonymous function returning the values for comparison
* elements, a property name of the objects, or an anonymous function returning the values for comparison
* purpose. The anonymous function signature should be: `function($item)`.
* purpose. The anonymous function signature should be: `function($item)`.
* To sort by multiple keys, provide an array of keys here.
* To sort by multiple keys, provide an array of keys here.
* @param
boolean|array $descending whether to sort in descending or ascending order. When
* @param
integer|array $direction the sorting direction. It can be either `SORT_ASC` or `SORT_DESC`.
*
sorting by multiple keys with different descending orders, use an array of descending flag
s.
*
When sorting by multiple keys with different sorting directions, use an array of sorting direction
s.
* @param integer|array $sortFlag the PHP sort flag. Valid values include
* @param integer|array $sortFlag the PHP sort flag. Valid values include
* `SORT_REGULAR`, `SORT_NUMERIC`, `SORT_STRING`, `SORT_LOCALE_STRING`, `SORT_NATURAL` and `SORT_FLAG_CASE`.
* `SORT_REGULAR`, `SORT_NUMERIC`, `SORT_STRING`, `SORT_LOCALE_STRING`, `SORT_NATURAL` and `SORT_FLAG_CASE`.
* Please refer to [PHP manual](http://php.net/manual/en/function.sort.php)
* Please refer to [PHP manual](http://php.net/manual/en/function.sort.php)
...
@@ -345,16 +345,16 @@ class BaseArrayHelper
...
@@ -345,16 +345,16 @@ class BaseArrayHelper
* @throws InvalidParamException if the $descending or $sortFlag parameters do not have
* @throws InvalidParamException if the $descending or $sortFlag parameters do not have
* correct number of elements as that of $key.
* correct number of elements as that of $key.
*/
*/
public
static
function
multisort
(
&
$array
,
$key
,
$d
escending
=
false
,
$sortFlag
=
SORT_REGULAR
,
$caseSensitive
=
true
)
public
static
function
multisort
(
&
$array
,
$key
,
$d
irection
=
SORT_ASC
,
$sortFlag
=
SORT_REGULAR
,
$caseSensitive
=
true
)
{
{
$keys
=
is_array
(
$key
)
?
$key
:
[
$key
];
$keys
=
is_array
(
$key
)
?
$key
:
[
$key
];
if
(
empty
(
$keys
)
||
empty
(
$array
))
{
if
(
empty
(
$keys
)
||
empty
(
$array
))
{
return
;
return
;
}
}
$n
=
count
(
$keys
);
$n
=
count
(
$keys
);
if
(
is_scalar
(
$d
escending
))
{
if
(
is_scalar
(
$d
irection
))
{
$d
escending
=
array_fill
(
0
,
$n
,
$descending
);
$d
irection
=
array_fill
(
0
,
$n
,
$direction
);
}
elseif
(
count
(
$d
escending
)
!==
$n
)
{
}
elseif
(
count
(
$d
irection
)
!==
$n
)
{
throw
new
InvalidParamException
(
'The length of $descending parameter must be the same as that of $keys.'
);
throw
new
InvalidParamException
(
'The length of $descending parameter must be the same as that of $keys.'
);
}
}
if
(
is_scalar
(
$sortFlag
))
{
if
(
is_scalar
(
$sortFlag
))
{
...
@@ -377,7 +377,7 @@ class BaseArrayHelper
...
@@ -377,7 +377,7 @@ class BaseArrayHelper
}
else
{
}
else
{
$args
[]
=
static
::
getColumn
(
$array
,
$key
);
$args
[]
=
static
::
getColumn
(
$array
,
$key
);
}
}
$args
[]
=
$d
escending
[
$i
]
?
SORT_DESC
:
SORT_ASC
;
$args
[]
=
$d
irection
;
$args
[]
=
$flag
;
$args
[]
=
$flag
;
}
}
$args
[]
=
&
$array
;
$args
[]
=
&
$array
;
...
...
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