Commit graph

91 commits

Author SHA1 Message Date
chinpei215
deac8f9109 Backport #7080, #8233 and #11060 2017-10-06 22:02:37 +09:00
Marc Würth
da8414e13b Use HTTPS for the opensource.org MIT license URL 2017-06-11 00:23:22 +02:00
Marc Würth
10b89b51a9 Use HTTPS for the cakefoundation.org URL 2017-06-11 00:10:59 +02:00
Marc Würth
17314baa15 Use HTTPS for the cakephp.org URL 2017-06-10 23:40:28 +02:00
mark_story
e698891d09 Hash::filter() should not exclude 0.0
Refs #10385
2017-03-09 21:29:44 -05:00
mark_story
3f10a0227a Allow false/true to be read as keys in Hash::get().
While these are not values within the documented types, there exist use
cases in CakeSession that necessitate these to be supported types.

Refs #10196
2017-02-13 21:50:51 -05:00
mark_story
c935bed8f6 Fix PHPCS 2016-10-21 18:35:05 -04:00
mark_story
816801902e Allow '' to be a valid key for Hash, and Session
By removing a bunch of empty() guards we can make '' behave like all the
other key names. This does change the existing behavior/tests around ''
key, but I think that is ok given the need to manipulate ''.

Refs #9632
2016-10-21 10:54:39 -04:00
mark_story
d1cfe203c4 Fix PHPCS error. 2016-08-29 21:53:47 -04:00
Mark Sch
ee319baec1 Backport skip 2016-08-26 16:15:39 +02:00
mscherer
03df288e78 Re-add spacing. 2016-08-26 14:45:59 +02:00
mscherer
dab4b85596 Backport Hash::sort() support for type locale. 2016-08-26 14:32:21 +02:00
Marc Würth
f2638b3e38 Remove superfluous "Class" from doc blocks 2016-08-10 12:22:09 +02:00
mark_story
a9ef1f8aea Simplify branching and add default options.
Use fewer conditionals by merging defaults and avoid exceptions
by setting defaults as well.

Refs #7217
2015-08-25 21:39:02 -04:00
Adrian Gunawan
2eafcc0f72 Use array() instead of the short notation [] 2015-08-14 14:55:44 +10:00
Adrian Gunawan
bf6574c3b2 Use array() instead of the short notation [] 2015-08-14 14:26:01 +10:00
Adrian Gunawan
b89d8d5efa Use array() instead of the short notation [] 2015-08-14 14:15:00 +10:00
Adrian Gunawan
f23e6589d0 Overload $type parameter instead of adding another parameter for case insensitive sort 2015-08-13 11:16:32 +10:00
Adrian Gunawan
a217556c13 Ability for Hash::sort to sort case-insensitively 2015-08-12 14:35:11 +10:00
Mark Story
de4b44a37b Merge pull request #7077 from dereuromark/2.7-static
Replacing self with static due to PHP5.3+. Following #7040.
2015-07-23 22:27:37 -04:00
mark_story
e4b2428735 Fix PHPCS errors. 2015-07-21 16:28:17 -04:00
Mark Scherer
52e79987a2 Replacing self with static due to PHP5.3+. Following #7040. 2015-07-21 10:22:53 +02:00
mark_story
bd23fdeebf Simplify code and reduce test redundancy.
We don't need the additional parameter, and some of the tests weren't
covering unique scenarios.

Refs #7040
2015-07-20 22:16:50 -04:00
Chris Valliere
7b2d7ad748 Test Case for Hash::maxDimensions
Added test case for Hash::maxDimensions using the example array in pull request #7040.
2015-07-20 22:07:58 -04:00
mark_story
032c01d18c Add other key types to {*} test. 2015-05-01 22:41:41 -04:00
mark_story
5e9d4893a8 Add the {*} matcher to Hash::extract()
This matcher will match anything and is useful when you just want to
traverse through data and you're not too picky.

I've also refactored the conditions to use a case as it is slightly more
readable and uses fewer lines of code.

Refs #6447
2015-05-01 22:03:40 -04:00
mark_story
a6aefdd4d3 Fix null path in Hash::get() causing exceptions.
This was a regression introduced in 2.6.x

Refs #6297
2015-04-09 07:50:29 -04:00
Mark van Driel
4a7344ae80 Keep only test for null value as path 2015-04-09 07:49:35 -04:00
Mark van Driel
900fd3e7e5 Test to demonstrate issue with non-string paths in Hash::get 2015-04-09 07:47:25 -04:00
mark_story
69971505a2 Fix maxDimensions() for empty/1 dimensional arrays.
maxDimensions() should not emit warnings or mis-calculate an array's
dimensions.

Fixes #6224
2015-03-31 22:21:15 -04:00
mark_story
af43bc1706 Merge branch 'master' into 2.6 2014-09-25 22:39:51 -04:00
Yves
b70cb132fd Fix Hash::remove() removing data even if the path is not matched 2014-09-23 22:00:49 +02:00
ADmad
3fb252ad2f Merge branch 'master' into 2.6 2014-09-13 00:37:16 +05:30
Yves
90ad813b40 Fix Hash not returning correct value with special paths
When doing a Hash::insert() with a part of the path starting with a '0', Hash::get() returned null even if the same path was used.
2014-09-10 22:47:25 +02:00
Marc Würth
c321a8fa93 Hash::nest() should throw an exception instead of returning an empty array
Refs: https://github.com/cakephp/cakephp/pull/3498#issuecomment-48316204
2014-07-08 13:01:02 +02:00
mark_story
a40fa5cae9 Add test for #3754 2014-06-25 09:19:24 -04:00
mark_story
fa19c34580 Fix Hash::extract() not matching 1/0 to true/false.
Historically [prop=1] has matched prop=true as well. This restores that
and also fixes [prop=0] not finding falsey values.

This makes the typing less strict in Hash::extract() but I don't think
it is unreasonable given PHP's type juggling.

Refs #3288
2014-06-12 11:30:48 -04:00
ADmad
543066f34a Set default sort direction to 'asc'. 2014-05-30 19:43:09 +05:30
euromark
143e8e4c56 Make sure invalid arrays return empty array instead of throwing notices. 2014-05-14 23:53:58 +02:00
mark_story
bf9c3029cb Merge branch 'master' into 2.5 2014-04-10 20:51:49 -04:00
mark_story
c6173a0054 Add tests for #3288 and remove nested ternaries.
Nested ternaries are complicated to maintain and hard to read. Break
down the nested ternary into two conditionals.
2014-04-10 20:37:08 -04:00
Jose Lorenzo Rodriguez
343d3279b9 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Test/Case/Utility/FileTest.php
	lib/Cake/VERSION.txt
2014-04-06 21:50:41 +02:00
euromark
0d09a54033 more missing doc block tags added 2014-04-02 03:02:37 +02:00
euromark
44952b06a4 cs 2014-04-02 02:23:43 +02:00
euromark
690f54ad9d more corrections in order 2014-01-10 00:33:27 +01:00
mark_story
99e4dbd827 Merge branch 'master' into 2.5 2013-12-23 11:58:07 -05:00
mark_story
62e89734ab Throw exceptions from Hash::combine()
When the key + value counts do not match Hash should throw an exception.
Silently doing the wrong thing is generally not a good idea. While this
change could break existing applications, those applications were
probably behaving incorrectly anyways.

Fixes #2470
2013-12-21 17:46:05 -05:00
mark_story
c2b8778ce8 Merge branch 'master' into 2.5 2013-12-14 17:45:49 -05:00
mark_story
79701af501 Make Hash::numeric() accept more numeric things.
Negative numbers and other stringy forms of numbers should be accepted.
The name Hash::numeric implies is_numeric which it now uses.

Fixes #2478
2013-12-12 17:41:38 -05:00
Jose Lorenzo Rodriguez
fc6edf4d9c Fixed small coding standard error 2013-12-12 09:07:00 +01:00