/** * @test */ public function arrayDiffAssocRecursiveHandlesMixedArrays() { $array1 = array('key1' => array('key11' => 'value11', 'key12' => 'value12'), 'key2' => 'value2', 'key3' => 'value3'); $array2 = array('key1' => 'value1', 'key2' => array('key21' => 'value21')); $expectedResult = array('key3' => 'value3'); $actualResult = \Kimai_Utility_ArrayUtility::arrayDiffAssocRecursive($array1, $array2); $this->assertEquals($expectedResult, $actualResult); }
if ($activityID <= 0) { continue; } $data = array(); foreach (array('budget', 'effort', 'approved') as $key) { $value = getRequestDecimal($_REQUEST[$key][$index]); if ($value !== null) { $data[$key] = max(0, $value); } else { $data[$key] = "null"; } } $database->project_activity_edit($id, $activityID, $data); } $arrayWithKeysFromValue = Kimai_Utility_ArrayUtility::setKeyFromValue($assignedActivities); $itemsToRemove = Kimai_Utility_ArrayUtility::arrayDiffAssocRecursive($projectActivities, $arrayWithKeysFromValue); // Remove fixed rate by removed activity assignment foreach ($itemsToRemove as $item) { $database->remove_fixed_rate($id, $item); } } else { $database->assignProjectToActivitiesForGroup($id, array(), $kga['user']['groups']); } } header('Content-Type: application/json;charset=utf-8'); echo json_encode(array('errors' => $errorMessages)); break; /** * add or edit a activity */ /**