protected function makeValidationRuleDataFromSpecialArraySyntax(array $rules, $key)
    {
        $data = new ValidationRuleData(
            array_get($rules, 'rules', []),
            array_get($rules, 'key', is_numeric($key) ? null : $key)
        );

        if (array_has($rules, 'translated')) {
            $data->setIsTranslated((bool) $rules['translated']);
        }

        if (array_has($rules, 'locale_index')) {

            // @codeCoverageIgnoreStart
            if ((int) $rules['locale_index'] < 1) {
                throw new UnexpectedValueException(
                    "Locale index for configured validation data cannot be less than 1 (key/index: {$key})"
                );
            }
            // @codeCoverageIgnoreEnd

            $data->setLocaleIndex((int) $rules['locale_index']);
        }

        return $data;
    }
protected function makeValidationRuleDataFromSpecialArraySyntax(array $rules, $key)
    {
        $data = new ValidationRuleData(
            array_get($rules, 'rules', []),
            array_get($rules, 'key', is_numeric($key) ? null : $key)
        );

        if (array_has($rules, 'translated')) {
            $data->setIsTranslated((bool) $rules['translated']);
        }

        if (array_has($rules, 'locale_index')) {

            // @codeCoverageIgnoreStart
            if ((int) $rules['locale_index'] < 1) {
                throw new UnexpectedValueException(
                    "Locale index for configured validation data cannot be less than 1 (key/index: {$key})"
                );
            }
            // @codeCoverageIgnoreEnd

            $data->setLocaleIndex((int) $rules['locale_index']);
        }

        return $data;
    }
protected function makeValidationRuleDataFromSpecialArraySyntax ( array $ rules , $ key ) { $ data = new ValidationRuleData ( array_get ( $ rules , 'rules' , [ ] ) , array_get ( $ rules , 'key' , is_numeric ( $ key ) ? null : $ key ) ) ; if ( array_has ( $ rules , 'translated' ) ) { $ data -> setIsTranslated ( ( bool ) $ rules [ 'translated' ] ) ; } if ( array_has ( $ rules , 'locale_index' ) ) { // @codeCoverageIgnoreStart if ( ( int ) $ rules [ 'locale_index' ] < 1 ) { throw new UnexpectedValueException ( "Locale index for configured validation data cannot be less than 1 (key/index: {$key})" ) ; } // @codeCoverageIgnoreEnd $ data -> setLocaleIndex ( ( int ) $ rules [ 'locale_index' ] ) ; } return $ data ; }
Makes a validation rule data object from a special configuration array.

@param array       $rules
@param null|string $key
@return ValidationRuleData
Makes a validation rule data object from a special configuration array .