lithium\g11n\catalog\adapter\Gettext::_merge()

protected method

Merges an item into given data and unescapes fields.

Please note that items with an id containing exclusively whitespace characters or are empty are not being merged. Whitespace characters are space, tab, vertical tab, line feed, carriage return and form feed.

Parameters

  • array $data

    Data to merge item into.

  • array $item

    Item to merge into $data.

Returns

array

The merged data.

Source

	protected function _merge(array $data, array $item) {
		$filter = function ($value) use (&$filter) {
			if (is_array($value)) {
				return array_map($filter, $value);
			}
			return stripcslashes($value);
		};
		$fields = array('id', 'ids', 'translated', 'context');

		foreach ($fields as $field) {
			if (isset($item[$field])) {
				$item[$field] = $filter($item[$field]);
			}
		}
		if (isset($item['ids']['singular'])) {
			$item['id'] = $item['ids']['singular'];
		}
		if (empty($item['id']) || ctype_space($item['id'])) {
			return $data;
		}
		return parent::_merge($data, $item);
	}