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
Guillaume Lafarge
db450a96e9
Fix Hash type casting
...
When using comparison with a boolean, as the filter is a string, we have to convert the data boolean to "boolean string" to avoid type-casting troubles.
## Example
```php
$users = [
[
'id' => 2,
'username' => 'johndoe',
'active' => true
],
[ 'id' => 5,
'username' => 'kevin',
'active' => true
],
[
'id' => 9,
'username' => 'samantha',
'active' => false
],
];
$unactiveUsers = Hash::extract($users, '{n}[active=false]');
print_r($unactiveUsers);
```
This example returns the two unwanted active users because `"false"` is `true` but not `false` :)
I think this pull request will fix this issue by converting true/false boolean to string (to match with our filter).
2014-04-10 20:19:32 +02:00
mark_story
99e4dbd827
Merge branch 'master' into 2.5
2013-12-23 11:58:07 -05:00
Saleh Souzanchi
328125ad43
Merge branch 'master' into master-phpcs-error-fix
2013-12-23 11:43:54 +03:30
Mark Story
321347e52b
Merge pull request #2532 from bar/patch-2
...
Trivial continue.
fix phpcs error "Missing @throws tag in function comment"
2013-12-23 11:21:18 +03:30
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
Gombos Lorand
764e368dc3
Check if the item is an array.
2013-12-05 12:03:07 +02:00
davidsteinsland
e68a61c375
Added configurable default value to Hash::get()
2013-10-31 23:31:48 +01:00
ADmad
d9ca148499
Merge branch 'master' into 2.5
...
Conflicts:
CONTRIBUTING.md
lib/Cake/Model/Model.php
lib/Cake/VERSION.txt
2013-10-30 02:34:09 +05:30
euromark
c08df2a7f9
Correct wording of Hash::expand()
2013-10-19 17:54:43 +02:00
mark_story
d2577fac60
Merge branch 'master' into 2.5
2013-09-21 20:01:50 -04:00
mark_story
a30f861f2c
Use array_key_exists instead of isset()
...
This allows contains() to work with null values.
Fixes #4083
2013-09-19 21:44:09 -04:00
mark_story
59bb05b433
Merge branch 'master' into 2.5
...
Conflicts:
lib/Cake/VERSION.txt
2013-09-02 11:35:09 -04:00
Kim Egede Jakobsen
46d3d8e48e
Added @link to all public functions there have documentation.
...
And correct a small 'typo'.
2013-08-31 17:12:29 -07:00
mark_story
f655e8a7bc
Minor simplification.
2013-08-24 21:49:17 -04:00
Chen Cohen
a0014e7a30
Ticket 4011 - Adding matchers support for Hash::remove() and Hash::insert()
2013-08-24 02:02:01 +03:00
euromark
6cf147e8c8
unify null checks - avoid method call in favor of strict check
2013-08-16 20:12:49 +02:00
euromark
f389435bae
coding standards and else block simplification
2013-07-03 19:27:17 +02:00
Marc Würth
4c9f0414cb
Improved the DocBlocks and other code cleanup
...
Fixed @license tag, url comes first
Whitespace and other minor code cleanup
Added some docblocks
2013-05-31 00:11:19 +02:00
mark_story
b533c1b3ba
Make named capture groups compatible with older PCRE versions.
...
CentOS is terrible and generally contains very old versions of PCRE.
Update patterns to use more backwards compatible named capture groups.
Fixes #3821
2013-05-09 12:18:26 -04:00
mark_story
246c09ae40
Allow character classes in attribute patterns.
...
Fixes #3706
2013-03-14 12:55:03 -04:00
Adam Taylor
433dd09ec4
Fix typos
2013-03-05 00:05:14 -07:00
euromark
111366d5c8
== to === and != to !== where applicable
2013-02-12 03:38:08 +01:00
Graham Weldon
66d856d883
Added extra line for referencing license file for copyright
2013-02-08 21:22:51 +09:00
Graham Weldon
7b860debe4
This commit is dedicated to Mark Story, who has put in much dedicated time and effort into CakePHP over the years.
...
I just wanted to ruin his evening, because this change needs to be merged into CakePHP 3.0.
2013-02-08 20:59:49 +09:00
mark_story
4af6039107
Merge branch 'master' into 2.3
...
Conflicts:
lib/Cake/Console/Command/Task/ModelTask.php
lib/Cake/Model/Model.php
2013-01-26 21:16:26 -05:00
Majna
5250c92635
Fix Hash::sort() 'natural' type fallback on PHP < 5.4
2013-01-25 01:07:45 +01:00
mark_story
0cdef75060
Fix failing tests.
...
I have no idea why the updated session test was expected to fail as the
data was written to the session.
Refs #3551
2013-01-21 21:13:35 -05:00
mark_story
75495705a6
Fix Hash::get($data, '0')
...
Fixes #3555
2013-01-21 20:50:46 -05:00
mark_story
d0d13acaf4
Merge branch 'master' into 2.3
2013-01-08 20:15:46 -05:00
Marco Tisi
8af76a5662
Closes ticket #3080 in CakePHP Lighthouse ( http://cakephp.lighthouseapp.com/projects/42648/tickets/3080-hashflatten-endless-loop-on-single-0-int-keys ).
...
Hash::flatten has a bug which causes an endless loop when try to flatten an integer key.
Probably the $data array pointer won't reset itself when doing:
$data = $element
and
list($data, $path) = array_pop($stack)
The solution is to reset the pointer after the assignments.
2013-01-08 11:49:52 +01:00
euromark
b811afbc44
double spaces to single ones
2012-12-22 23:48:15 +01:00
mark_story
554d5794ce
Merge branch 'master' into 2.3
2012-12-19 21:18:52 -05:00
mark_story
f326058a6d
Update docs for Hash::apply()
2012-12-16 23:03:43 -05:00
dogmatic69
2266292594
fixing bug in Hash where array is not similar to the path required
2012-12-14 22:45:52 +00:00
mark_story
8b0a7ee13d
Merge branch 'master' into 2.3
...
Conflicts:
lib/Cake/VERSION.txt
2012-12-07 20:53:10 -05:00
mark_story
6cf6903982
Fix incorrect argument order.
2012-12-07 14:40:27 -05:00
dogmatic69
85de93a4a7
fixing issue where merge is renumbering array keys
2012-12-07 01:26:14 +00:00
Jose Lorenzo Rodriguez
0f5fa290ed
Merge remote-tracking branch 'origin/master' into 2.3
2012-12-01 23:19:53 +01:00
mark_story
889c1ebc09
Fix sorting empty data with Hash & Set.
...
Fixes #3420
2012-11-30 13:05:14 -05:00
ADmad
72d6ca636f
Docblock fixes
2012-11-29 04:36:29 +05:30
Ber Clausen
8b2b077119
Set::flatten() fails to generate keys when 'tip' value is an empty
...
array.
2012-11-02 19:23:55 -03:00
Kyle Robinson Young
bc40ac7d3f
Remove unused variables and code
2012-09-05 17:19:13 -07:00
Juan Basso
ecdf0e6c6c
Optimization for Hash method
2012-06-24 12:47:30 -04:00
mark_story
01b3135a63
You should be able to regex match null/''
...
Fixes #2926
2012-05-30 21:28:18 -04:00
Jelle Henkens
f7ce5262b7
Updating mixed @param documentation to seperate list of accepted types
2012-05-21 21:55:10 +01:00
mark_story
eeec362741
Merge remote-tracking branch 'ceeram/2.2-hash' into 2.2-hash
2012-04-07 14:28:40 -04:00
mark_story
83789915a3
Update docs about PHP5.4 constant.
2012-04-04 21:36:56 -04:00
Ceeram
7700a0261b
only use and test SORT_NATURAL on PHP 5.4
2012-04-04 18:21:52 +02:00
mark_story
e5ca80b711
Add additional sort flag support.
...
Add natural, numeric, and string sorting to Hash.
Fixes #1700
2012-04-01 23:09:15 -04:00
mark_story
432d00de19
Another small optimization.
2012-03-31 21:37:10 -04:00
mark_story
7d098fa5f0
Some small performance optimizations.
2012-03-31 21:25:02 -04:00
mark_story
95d4549c9b
Docs + coding standards.
2012-03-26 22:57:50 -04:00
mark_story
c087576f20
Port changes done to Set into Hash
...
See #2722
2012-03-26 22:39:13 -04:00
mark_story
66eabe462a
Copy Set::expand into Hash class.
2012-03-26 22:32:58 -04:00
mark_story
9015d78017
Port most recent changes in Set to Hash.
...
See [68eeee80d8
] and
[af575027da
]
2012-03-26 22:32:56 -04:00
mark_story
e55927c007
Update the doc links.
2012-03-26 22:32:56 -04:00
mark_story
0ef9adba93
Move and rename pushDiff onto Hash.
...
Its used internally in a number of places and diff() + merge()
are not an resonable replacement.
2012-03-26 22:32:54 -04:00
mark_story
19e0d8d946
Switch usage to Hash where possible.
2012-03-26 22:32:53 -04:00
mark_story
2231087ba3
Rename Set2 -> Hash.
2012-03-26 22:25:40 -04:00