public function validatePluralKeys($file, $key, $against_language, $validate_language)
	{
		$origin_cases = array_keys($validate_language);

		if (empty($origin_cases))
		{
			$this->output->addMessage(Output::FATAL, 'Plural array must not be empty', $file, $key);
			return;
		}

		$valid_cases = $this->getPluralKeys($this->pluralRule);

		$intersect_cases = array_intersect($origin_cases, $valid_cases);
		$missing_cases = array_diff($valid_cases, $origin_cases);
		$additional_cases = array_diff($origin_cases, $valid_cases, array(0));

		if (!empty($additional_cases))
		{
			$this->output->addMessage(Output::FATAL, 'Plural array has additional case: ' . implode(', ', $additional_cases), $file, $key);
		}

		if (empty($intersect_cases))
		{
			// No intersection means there are no entries apart from the 0
			$this->output->addMessage(Output::FATAL, 'Plural array must not be empty', $file, $key);
			return;
		}

		if (!empty($missing_cases))
		{
			// Do we want to allow this? Lazy translators...
			$this->output->addMessage(Output::WARNING, 'Plural array is missing case: ' . implode(', ', $missing_cases), $file, $key);
		}

		if (!empty($intersect_cases))
		{
			$compare_against = '';
			if ($against_language)
			{
				$compare_against = end($against_language);
			}

			foreach ($intersect_cases as $case)
			{
				$this->validateString($file, $key . '.' . $case, $compare_against, $validate_language[$case], true);
			}
		}
	}
public function validatePluralKeys($file, $key, $against_language, $validate_language)
	{
		$origin_cases = array_keys($validate_language);

		if (empty($origin_cases))
		{
			$this->output->addMessage(Output::FATAL, 'Plural array must not be empty', $file, $key);
			return;
		}

		$valid_cases = $this->getPluralKeys($this->pluralRule);

		$intersect_cases = array_intersect($origin_cases, $valid_cases);
		$missing_cases = array_diff($valid_cases, $origin_cases);
		$additional_cases = array_diff($origin_cases, $valid_cases, array(0));

		if (!empty($additional_cases))
		{
			$this->output->addMessage(Output::FATAL, 'Plural array has additional case: ' . implode(', ', $additional_cases), $file, $key);
		}

		if (empty($intersect_cases))
		{
			// No intersection means there are no entries apart from the 0
			$this->output->addMessage(Output::FATAL, 'Plural array must not be empty', $file, $key);
			return;
		}

		if (!empty($missing_cases))
		{
			// Do we want to allow this? Lazy translators...
			$this->output->addMessage(Output::WARNING, 'Plural array is missing case: ' . implode(', ', $missing_cases), $file, $key);
		}

		if (!empty($intersect_cases))
		{
			$compare_against = '';
			if ($against_language)
			{
				$compare_against = end($against_language);
			}

			foreach ($intersect_cases as $case)
			{
				$this->validateString($file, $key . '.' . $case, $compare_against, $validate_language[$case], true);
			}
		}
	}
public function validatePluralKeys ( $ file , $ key , $ against_language , $ validate_language ) { $ origin_cases = array_keys ( $ validate_language ) ; if ( empty ( $ origin_cases ) ) { $ this -> output -> addMessage ( Output :: FATAL , 'Plural array must not be empty' , $ file , $ key ) ; return ; } $ valid_cases = $ this -> getPluralKeys ( $ this -> pluralRule ) ; $ intersect_cases = array_intersect ( $ origin_cases , $ valid_cases ) ; $ missing_cases = array_diff ( $ valid_cases , $ origin_cases ) ; $ additional_cases = array_diff ( $ origin_cases , $ valid_cases , array ( 0 ) ) ; if ( ! empty ( $ additional_cases ) ) { $ this -> output -> addMessage ( Output :: FATAL , 'Plural array has additional case: ' . implode ( ', ' , $ additional_cases ) , $ file , $ key ) ; } if ( empty ( $ intersect_cases ) ) { // No intersection means there are no entries apart from the 0 $ this -> output -> addMessage ( Output :: FATAL , 'Plural array must not be empty' , $ file , $ key ) ; return ; } if ( ! empty ( $ missing_cases ) ) { // Do we want to allow this? Lazy translators... $ this -> output -> addMessage ( Output :: WARNING , 'Plural array is missing case: ' . implode ( ', ' , $ missing_cases ) , $ file , $ key ) ; } if ( ! empty ( $ intersect_cases ) ) { $ compare_against = '' ; if ( $ against_language ) { $ compare_against = end ( $ against_language ) ; } foreach ( $ intersect_cases as $ case ) { $ this -> validateString ( $ file , $ key . '.' . $ case , $ compare_against , $ validate_language [ $ case ] , true ) ; } } }
Validates the plural keys

The set of plural cases should not be empty
There might be an additional case for 0 items
There must not be an additional case
There might be less cases then possible

@param    string $file File to validate
@param    string $key Key to validate
@param    array $against_language Original language
@param    array $validate_language Translated language
@return    null
@throws \Exception
Validates the plural keys