From e4118a7eabfdfe5bc154797654ecbbe4668ec15b Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 23 Jul 2018 14:28:36 -0400 Subject: [PATCH] Remove deprecated recursive array utils --- CRM/Utils/Array.php | 51 --------------------------- tests/phpunit/CRM/Utils/ArrayTest.php | 8 ++--- 2 files changed, 4 insertions(+), 55 deletions(-) diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php index 99a7fd7018..083aa3468d 100644 --- a/CRM/Utils/Array.php +++ b/CRM/Utils/Array.php @@ -1172,55 +1172,4 @@ class CRM_Utils_Array { return NULL; } - /** - * Check if a key isset which may be several layers deep. - * - * This is a helper for when the calling function does not know how many layers deep the - * path array is so cannot easily check. - * - * @param array $array - * @param array $path - * @return bool - * @deprecated - */ - public static function recursiveIsset($array, $path) { - return self::pathIsset($array, $path); - } - - /** - * Check if a key isset which may be several layers deep. - * - * This is a helper for when the calling function does not know how many layers deep the - * path array is so cannot easily check. - * - * @param array $array - * @param array $path - * An array of keys - e.g [0, 'bob', 8] where we want to check if $array[0]['bob'][8] - * @param mixed $default - * Value to return if not found. - * @return bool - * @deprecated - */ - public static function recursiveValue($array, $path, $default = NULL) { - return self::pathGet($array, $path, $default); - } - - /** - * Append the value to the array using the key provided. - * - * e.g if value is 'llama' & path is [0, 'email', 'location'] result will be - * [0 => ['email' => ['location' => 'llama']] - * - * @param $path - * @param $value - * @param array $source - * - * @return array - * @deprecated - */ - public static function recursiveBuild($path, $value, $source = []) { - self::pathSet($source, $path, $value); - return $source; - } - } diff --git a/tests/phpunit/CRM/Utils/ArrayTest.php b/tests/phpunit/CRM/Utils/ArrayTest.php index 979e5bbefa..135b0f05c5 100644 --- a/tests/phpunit/CRM/Utils/ArrayTest.php +++ b/tests/phpunit/CRM/Utils/ArrayTest.php @@ -260,7 +260,7 @@ class CRM_Utils_ArrayTest extends CiviUnitTestCase { * @dataProvider getRecursiveIssetExamples */ public function testRecursiveIsset($array, $path, $expected) { - $result = CRM_Utils_Array::recursiveIsset($array, $path); + $result = CRM_Utils_Array::pathIsset($array, $path); $this->assertEquals($expected, $result); } @@ -294,7 +294,7 @@ class CRM_Utils_ArrayTest extends CiviUnitTestCase { * @dataProvider getRecursiveValueExamples */ public function testRecursiveValue($array, $path, $default, $expected) { - $result = CRM_Utils_Array::recursiveValue($array, $path, $default); + $result = CRM_Utils_Array::pathGet($array, $path, $default); $this->assertEquals($expected, $result); } @@ -324,8 +324,8 @@ class CRM_Utils_ArrayTest extends CiviUnitTestCase { * @dataProvider getBuildValueExamples */ public function testBuildRecursiveValue($source, $path, $expected) { - $result = CRM_Utils_Array::recursiveBuild($path, 'llama', $source); - $this->assertEquals($expected, $result); + CRM_Utils_Array::pathSet($source, $path, 'llama'); + $this->assertEquals($expected, $source); } } -- 2.25.1