/** * Remove keys from LocalConfiguration * * @param array $keys Array with key paths to remove from LocalConfiguration * @return boolean TRUE if something was removed */ public function removeLocalConfigurationKeysByPath(array $keys) { $result = FALSE; $localConfiguration = $this->getLocalConfiguration(); foreach ($keys as $path) { // Remove key if path is within LocalConfiguration if (Utility\ArrayUtility::isValidPath($localConfiguration, $path)) { $result = TRUE; $localConfiguration = Utility\ArrayUtility::removeByPath($localConfiguration, $path); } } if ($result) { $this->writeLocalConfiguration($localConfiguration); } return $result; }
/** * @test * @dataProvider removeByPathRemovesCorrectPathDataProvider */ public function removeByPathRemovesCorrectPath(array $array, $path, $expectedResult) { $this->assertEquals($expectedResult, ArrayUtility::removeByPath($array, $path)); }