lithium\data\source\mongo_db\Exporter::_diff()

protected static method

Handle diffing operations between Document object states. Implemented because all of PHP's array comparison functions are broken when working with objects.

Parameters

  • array $left

    The left-hand comparison array.

  • array $right

    The right-hand comparison array.

Returns

array

Returns an array of the differences of $left compared to $right.

Source

	protected static function _diff($left, $right) {
		$result = [];

		foreach ($left as $key => $value) {
			if (!array_key_exists($key, $right) || $left[$key] !== $right[$key]) {
				$result[$key] = $value;
			}
		}
		return $result;
	}