Skip to content

Commit

Permalink
Merge pull request cakephp#369 from okonomi/core-utility-libraries-se…
Browse files Browse the repository at this point in the history
…t-fix

Fixed indentation in core-utility-libraries/set.rst
  • Loading branch information
shama committed Aug 31, 2012
2 parents b0ef827 + 31acc24 commit 72757c1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
28 changes: 14 additions & 14 deletions en/core-utility-libraries/set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,24 @@ available.
.. php:staticmethod:: apply($path, $array, $callback, $options = array())
:rtype: mixed
:rtype: mixed

Apply a callback to the elements of an array extracted
by a Set::extract compatible path::
Apply a callback to the elements of an array extracted
by a Set::extract compatible path::

<?php
$data = array(
array('Movie' => array('id' => 1, 'title' => 'movie 3', 'rating' => 5)),
array('Movie' => array('id' => 1, 'title' => 'movie 1', 'rating' => 1)),
array('Movie' => array('id' => 1, 'title' => 'movie 2', 'rating' => 3)),
);
<?php
$data = array(
array('Movie' => array('id' => 1, 'title' => 'movie 3', 'rating' => 5)),
array('Movie' => array('id' => 1, 'title' => 'movie 1', 'rating' => 1)),
array('Movie' => array('id' => 1, 'title' => 'movie 2', 'rating' => 3)),
);

$result = Set::apply('/Movie/rating', $data, 'array_sum');
// result equals 9
$result = Set::apply('/Movie/rating', $data, 'array_sum');
// result equals 9

$result = Set::apply('/Movie/title', $data, 'strtoupper', array('type' => 'map'));
// result equals array('MOVIE 3', 'MOVIE 1', 'MOVIE 2')
// $options are: - type : can be 'pass' uses call_user_func_array(), 'map' uses array_map(), or 'reduce' uses array_reduce()
$result = Set::apply('/Movie/title', $data, 'strtoupper', array('type' => 'map'));
// result equals array('MOVIE 3', 'MOVIE 1', 'MOVIE 2')
// $options are: - type : can be 'pass' uses call_user_func_array(), 'map' uses array_map(), or 'reduce' uses array_reduce()


.. php:staticmethod:: check($data, $path = null)
Expand Down
28 changes: 14 additions & 14 deletions fr/core-utility-libraries/set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@ available.
.. php:staticmethod:: apply($path, $array, $callback, $options = array())
:rtype: mixed
:rtype: mixed

Apply a callback to the elements of an array extracted
by a Set::extract compatible path::
Apply a callback to the elements of an array extracted
by a Set::extract compatible path::

<?php
$data = array(
array('Movie' => array('id' => 1, 'title' => 'movie 3', 'rating' => 5)),
array('Movie' => array('id' => 1, 'title' => 'movie 1', 'rating' => 1)),
array('Movie' => array('id' => 1, 'title' => 'movie 2', 'rating' => 3)),
);
<?php
$data = array(
array('Movie' => array('id' => 1, 'title' => 'movie 3', 'rating' => 5)),
array('Movie' => array('id' => 1, 'title' => 'movie 1', 'rating' => 1)),
array('Movie' => array('id' => 1, 'title' => 'movie 2', 'rating' => 3)),
);

$result = Set::apply('/Movie/rating', $data, 'array_sum');
// result equals 9
$result = Set::apply('/Movie/rating', $data, 'array_sum');
// result equals 9

$result = Set::apply('/Movie/title', $data, 'strtoupper', array('type' => 'map'));
// result equals array('MOVIE 3', 'MOVIE 1', 'MOVIE 2')
// $options are: - type : can be 'pass' uses call_user_func_array(), 'map' uses array_map(), or 'reduce' uses array_reduce()
$result = Set::apply('/Movie/title', $data, 'strtoupper', array('type' => 'map'));
// result equals array('MOVIE 3', 'MOVIE 1', 'MOVIE 2')
// $options are: - type : can be 'pass' uses call_user_func_array(), 'map' uses array_map(), or 'reduce' uses array_reduce()


.. php:staticmethod:: check($data, $path = null)
Expand Down
26 changes: 13 additions & 13 deletions ja/core-utility-libraries/set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ Set互換のパス記法
.. php:staticmethod:: apply($path, $array, $callback, $options = array())
:rtype: mixed
:rtype: mixed

Set::extract互換のパスで展開された配列の要素にコールバックを適用します ::
Set::extract互換のパスで展開された配列の要素にコールバックを適用します ::

<?php
$data = array(
array('Movie' => array('id' => 1, 'title' => 'movie 3', 'rating' => 5)),
array('Movie' => array('id' => 1, 'title' => 'movie 1', 'rating' => 1)),
array('Movie' => array('id' => 1, 'title' => 'movie 2', 'rating' => 3)),
);
<?php
$data = array(
array('Movie' => array('id' => 1, 'title' => 'movie 3', 'rating' => 5)),
array('Movie' => array('id' => 1, 'title' => 'movie 1', 'rating' => 1)),
array('Movie' => array('id' => 1, 'title' => 'movie 2', 'rating' => 3)),
);

$result = Set::apply('/Movie/rating', $data, 'array_sum');
// resultは 9 に等しい
$result = Set::apply('/Movie/rating', $data, 'array_sum');
// resultは 9 に等しい

$result = Set::apply('/Movie/title', $data, 'strtoupper', array('type' => 'map'));
// resultは array('MOVIE 3', 'MOVIE 1', 'MOVIE 2') に等しい
// $options: - type : 'pass'はcall_user_func_array()、'map'はarray_map()、'reduce'はarray_reduce()、が利用できます。
$result = Set::apply('/Movie/title', $data, 'strtoupper', array('type' => 'map'));
// resultは array('MOVIE 3', 'MOVIE 1', 'MOVIE 2') に等しい
// $options: - type : 'pass'はcall_user_func_array()、'map'はarray_map()、'reduce'はarray_reduce()、が利用できます。


.. php:staticmethod:: check($data, $path = null)
Expand Down

0 comments on commit 72757c1

Please sign in to comment.