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
a87c55ff
Commit
a87c55ff
authored
Nov 09, 2014
by
pana1990
Committed by
Qiang Xue
Nov 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix camelCase syntax
parent
05263692
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
BaseArrayHelper.php
framework/helpers/BaseArrayHelper.php
+9
-9
No files found.
framework/helpers/BaseArrayHelper.php
View file @
a87c55ff
...
...
@@ -580,7 +580,7 @@ class BaseArrayHelper
* // output : Spain, France, and Italy
*
* // working with options for change behavior
* \yii\helpers\ArrayHelper::sentence($array, ['last
_word_c
onnector' => ' or ']);
* \yii\helpers\ArrayHelper::sentence($array, ['last
WordC
onnector' => ' or ']);
* // output : Spain, France or Italy
* ~~~
*
...
...
@@ -588,13 +588,13 @@ class BaseArrayHelper
* @param array $options the options in terms of name-value pairs. The following options
* are specially handled:
*
* - words
_c
onnector: The sign or word used to join the elements in arrays with two or
* - words
C
onnector: The sign or word used to join the elements in arrays with two or
* more elements. By default ', ''.
*
* - two
_words_c
onnector: The sign or word used to join the elements in arrays with two
* - two
WordsC
onnector: The sign or word used to join the elements in arrays with two
* elements. By default ' and '.
*
* - last
_word_c
onnector: The sign or word used to join the last element in arrays with
* - last
WordC
onnector: The sign or word used to join the last element in arrays with
* three or more elements. By default ', and '.
*
* - locale: If i18n is available, you can set a locale and use the traslation file defined
...
...
@@ -605,9 +605,9 @@ class BaseArrayHelper
public
static
function
sentence
(
$array
,
$options
=
[])
{
$default_options
=
[
'words
_c
onnector'
=>
', '
,
'two
_words_c
onnector'
=>
' and '
,
'last
_word_c
onnector'
=>
', and '
,
'words
C
onnector'
=>
', '
,
'two
WordsC
onnector'
=>
' and '
,
'last
WordC
onnector'
=>
', and '
,
'locale'
=>
Yii
::
$app
->
language
];
...
...
@@ -621,9 +621,9 @@ class BaseArrayHelper
case
1
:
return
$array
[
0
];
case
2
:
return
$array
[
0
]
.
\Yii
::
t
(
'yii'
,
$options
[
'two
_words_c
onnector'
],
[],
$options
[
'locale'
])
.
$array
[
1
];
return
$array
[
0
]
.
\Yii
::
t
(
'yii'
,
$options
[
'two
WordsC
onnector'
],
[],
$options
[
'locale'
])
.
$array
[
1
];
default
:
return
implode
(
$options
[
'words
_connector'
],
array_slice
(
$array
,
0
,
-
1
))
.
\Yii
::
t
(
'yii'
,
$options
[
'last_word_c
onnector'
],
[],
$options
[
'locale'
])
.
$array
[
$count
-
1
];
return
implode
(
$options
[
'words
Connector'
],
array_slice
(
$array
,
0
,
-
1
))
.
\Yii
::
t
(
'yii'
,
$options
[
'lastWordC
onnector'
],
[],
$options
[
'locale'
])
.
$array
[
$count
-
1
];
}
}
}
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