mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
parent
efadf3dcd3
commit
75495705a6
2 changed files with 9 additions and 1 deletions
|
@ -170,6 +170,14 @@ class HashTest extends CakeTestCase {
|
|||
* return void
|
||||
*/
|
||||
public function testGet() {
|
||||
$data = array('abc', 'def');
|
||||
|
||||
$result = Hash::get($data, '0');
|
||||
$this->assertEquals('abc', $result);
|
||||
|
||||
$result = Hash::get($data, '1');
|
||||
$this->assertEquals('def', $result);
|
||||
|
||||
$data = self::articleData();
|
||||
|
||||
$result = Hash::get(array(), '1.Article.title');
|
||||
|
|
|
@ -39,7 +39,7 @@ class Hash {
|
|||
* @return mixed The value fetched from the array, or null.
|
||||
*/
|
||||
public static function get(array $data, $path) {
|
||||
if (empty($data) || empty($path)) {
|
||||
if (empty($data)) {
|
||||
return null;
|
||||
}
|
||||
if (is_string($path)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue