Created
February 12, 2015 19:56
-
-
Save zephster/fc5df03aed7458b43ef7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function _diff($old, $new) | |
{ | |
$diffs = array(); | |
foreach ($old as $section => $v) | |
{ | |
if (is_array($v)) | |
{ | |
$array_diffs = $this->_diff($v, $new[$section]); | |
if (!empty($array_diffs)) | |
$diffs[$section] = (isset($array_diffs[0]) ? $array_diffs[0] : $array_diffs); | |
} | |
else | |
{ | |
// sabre often doesn't have certain, specific pieces of data that we do have, | |
// and we don't want to blank out our data, so skip any blanks | |
if ($new[$section] != $v && !empty($new[$section])) | |
{ | |
$diffs[$section]['old'] = $v; | |
$diffs[$section]['new'] = $new[$section]; | |
} | |
} | |
} | |
return $diffs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment