public function registerErrorTemplatesFromConfig(array $config)
    {
        foreach ($config as $key => $template) {
            if (trim($key) === '') {
                throw new InvalidArgumentException('Error template config key cannot be empty');
            }

            if (mb_strpos($key, '.') === false) {
                $this->registerGlobalErrorTemplate($key, $template);
            } else {
                $keyParts = explode('.', $key);

                if (count($keyParts) !== 2 || trim($keyParts[0]) === '' || trim($keyParts[1]) === '') {
                    throw new InvalidArgumentException('Error template config key cannot be empty');
                }

                $this->registerFieldErrorTemplate($keyParts[0], $keyParts[1], $template);
            }
        }
    }
public function registerErrorTemplatesFromConfig(array $config)
    {
        foreach ($config as $key => $template) {
            if (trim($key) === '') {
                throw new InvalidArgumentException('Error template config key cannot be empty');
            }

            if (mb_strpos($key, '.') === false) {
                $this->registerGlobalErrorTemplate($key, $template);
            } else {
                $keyParts = explode('.', $key);

                if (count($keyParts) !== 2 || trim($keyParts[0]) === '' || trim($keyParts[1]) === '') {
                    throw new InvalidArgumentException('Error template config key cannot be empty');
                }

                $this->registerFieldErrorTemplate($keyParts[0], $keyParts[1], $template);
            }
        }
    }
public function registerErrorTemplatesFromConfig ( array $ config ) { foreach ( $ config as $ key => $ template ) { if ( trim ( $ key ) === '' ) { throw new InvalidArgumentException ( 'Error template config key cannot be empty' ) ; } if ( mb_strpos ( $ key , '.' ) === false ) { $ this -> registerGlobalErrorTemplate ( $ key , $ template ) ; } else { $ keyParts = explode ( '.' , $ key ) ; if ( count ( $ keyParts ) !== 2 || trim ( $ keyParts [ 0 ] ) === '' || trim ( $ keyParts [ 1 ] ) === '' ) { throw new InvalidArgumentException ( 'Error template config key cannot be empty' ) ; } $ this -> registerFieldErrorTemplate ( $ keyParts [ 0 ] , $ keyParts [ 1 ] , $ template ) ; } } }
Registers error templates from a config array

@param array $config The mapping of rules to error templates
Global error templates should be formatted "{slug}" => "{template}"
Field error templates should be formatted "{field}.{slug}" => "{template}"
@throws InvalidArgumentException Thrown if the config was invalid
Registers error templates from a config array