protected function _merge(array $data, array $item) {
		if (!isset($item['id'])) {
			return $data;
		}
		$id = $item['id'];

		$defaults = [
			'ids' => [],
			'translated' => null,
			'flags' => [],
			'comments' => [],
			'occurrences' => []
		];
		$item += $defaults;

		if (isset($item['context']) && $item['context']) {
			$id .= '|' . $item['context'];
		}

		if (!isset($data[$id])) {
			$data[$id] = $item;
			return $data;
		}
		foreach (['ids', 'flags', 'comments', 'occurrences'] as $field) {
			$data[$id][$field] = array_merge($data[$id][$field], $item[$field]);
		}
		if (!isset($data[$id]['translated'])) {
			$data[$id]['translated'] = $item['translated'];
		} elseif (is_array($item['translated'])) {
			$data[$id]['translated'] = (array) $data[$id]['translated'] + $item['translated'];
		}
		return $data;
	}
protected function _merge(array $data, array $item) {
		if (!isset($item['id'])) {
			return $data;
		}
		$id = $item['id'];

		$defaults = [
			'ids' => [],
			'translated' => null,
			'flags' => [],
			'comments' => [],
			'occurrences' => []
		];
		$item += $defaults;

		if (isset($item['context']) && $item['context']) {
			$id .= '|' . $item['context'];
		}

		if (!isset($data[$id])) {
			$data[$id] = $item;
			return $data;
		}
		foreach (['ids', 'flags', 'comments', 'occurrences'] as $field) {
			$data[$id][$field] = array_merge($data[$id][$field], $item[$field]);
		}
		if (!isset($data[$id]['translated'])) {
			$data[$id]['translated'] = $item['translated'];
		} elseif (is_array($item['translated'])) {
			$data[$id]['translated'] = (array) $data[$id]['translated'] + $item['translated'];
		}
		return $data;
	}
protected function _merge ( array $ data , array $ item ) { if ( ! isset ( $ item [ 'id' ] ) ) { return $ data ; } $ id = $ item [ 'id' ] ; $ defaults = [ 'ids' => [ ] , 'translated' => null , 'flags' => [ ] , 'comments' => [ ] , 'occurrences' => [ ] ] ; $ item += $ defaults ; if ( isset ( $ item [ 'context' ] ) && $ item [ 'context' ] ) { $ id .= '|' . $ item [ 'context' ] ; } if ( ! isset ( $ data [ $ id ] ) ) { $ data [ $ id ] = $ item ; return $ data ; } foreach ( [ 'ids' , 'flags' , 'comments' , 'occurrences' ] as $ field ) { $ data [ $ id ] [ $ field ] = array_merge ( $ data [ $ id ] [ $ field ] , $ item [ $ field ] ) ; } if ( ! isset ( $ data [ $ id ] [ 'translated' ] ) ) { $ data [ $ id ] [ 'translated' ] = $ item [ 'translated' ] ; } elseif ( is_array ( $ item [ 'translated' ] ) ) { $ data [ $ id ] [ 'translated' ] = ( array ) $ data [ $ id ] [ 'translated' ] + $ item [ 'translated' ] ; } return $ data ; }
Merges an item into given data.

@param array $data Data to merge item into.
@param array $item Item to merge into $data. The item must have an `'id'` key.
@return array The merged data.
Merges an item into given data .