protected function register($config)
    {
        $this->validators = array();

        if (array_key_exists( 'length', $config ) && (int) $config['length']) {
            $this->validators[] = new \tao_helpers_form_validators_Length( array( 'min' => (int) $config['length'] ) );
        }

        if (( array_key_exists( 'upper', $config ) && $config['upper'] )
            || ( array_key_exists( 'lower', $config ) && $config['lower'] )
        ) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include at least one letter' ),
                    'format'  => '/\pL/'
                ), 'letters'
            );
        }

        if (( array_key_exists( 'upper', $config ) && $config['upper'] )) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include upper case letters' ),
                    'format'  => '/(\p{Lu}+)/',
                ), 'caseUpper'
            );
        }

        if (( array_key_exists( 'lower', $config ) && $config['lower'] )) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include lower case letters' ),
                    'format'  => '/(\p{Ll}+)/'
                ), 'caseLower'
            );
        }

        if (array_key_exists( 'number', $config ) && $config['number']) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include at least one number' ),
                    'format'  => '/\pN/'
                ), 'number'
            );
        }

        if (array_key_exists( 'spec', $config ) && $config['spec']) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include at least one special letter' ),
                    'format'  => '/[^p{Ll}\p{Lu}\pL\pN]/'
                ), 'spec'
            );
        }

    }
protected function register($config)
    {
        $this->validators = array();

        if (array_key_exists( 'length', $config ) && (int) $config['length']) {
            $this->validators[] = new \tao_helpers_form_validators_Length( array( 'min' => (int) $config['length'] ) );
        }

        if (( array_key_exists( 'upper', $config ) && $config['upper'] )
            || ( array_key_exists( 'lower', $config ) && $config['lower'] )
        ) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include at least one letter' ),
                    'format'  => '/\pL/'
                ), 'letters'
            );
        }

        if (( array_key_exists( 'upper', $config ) && $config['upper'] )) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include upper case letters' ),
                    'format'  => '/(\p{Lu}+)/',
                ), 'caseUpper'
            );
        }

        if (( array_key_exists( 'lower', $config ) && $config['lower'] )) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include lower case letters' ),
                    'format'  => '/(\p{Ll}+)/'
                ), 'caseLower'
            );
        }

        if (array_key_exists( 'number', $config ) && $config['number']) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include at least one number' ),
                    'format'  => '/\pN/'
                ), 'number'
            );
        }

        if (array_key_exists( 'spec', $config ) && $config['spec']) {
            $this->validators[] = new \tao_helpers_form_validators_Regex(
                array(
                    'message' => __( 'Must include at least one special letter' ),
                    'format'  => '/[^p{Ll}\p{Lu}\pL\pN]/'
                ), 'spec'
            );
        }

    }
protected function register ( $ config ) { $ this -> validators = array ( ) ; if ( array_key_exists ( 'length' , $ config ) && ( int ) $ config [ 'length' ] ) { $ this -> validators [ ] = new \ tao_helpers_form_validators_Length ( array ( 'min' => ( int ) $ config [ 'length' ] ) ) ; } if ( ( array_key_exists ( 'upper' , $ config ) && $ config [ 'upper' ] ) || ( array_key_exists ( 'lower' , $ config ) && $ config [ 'lower' ] ) ) { $ this -> validators [ ] = new \ tao_helpers_form_validators_Regex ( array ( 'message' => __ ( 'Must include at least one letter' ) , 'format' => '/\pL/' ) , 'letters' ) ; } if ( ( array_key_exists ( 'upper' , $ config ) && $ config [ 'upper' ] ) ) { $ this -> validators [ ] = new \ tao_helpers_form_validators_Regex ( array ( 'message' => __ ( 'Must include upper case letters' ) , 'format' => '/(\p{Lu}+)/' , ) , 'caseUpper' ) ; } if ( ( array_key_exists ( 'lower' , $ config ) && $ config [ 'lower' ] ) ) { $ this -> validators [ ] = new \ tao_helpers_form_validators_Regex ( array ( 'message' => __ ( 'Must include lower case letters' ) , 'format' => '/(\p{Ll}+)/' ) , 'caseLower' ) ; } if ( array_key_exists ( 'number' , $ config ) && $ config [ 'number' ] ) { $ this -> validators [ ] = new \ tao_helpers_form_validators_Regex ( array ( 'message' => __ ( 'Must include at least one number' ) , 'format' => '/\pN/' ) , 'number' ) ; } if ( array_key_exists ( 'spec' , $ config ) && $ config [ 'spec' ] ) { $ this -> validators [ ] = new \ tao_helpers_form_validators_Regex ( array ( 'message' => __ ( 'Must include at least one special letter' ) , 'format' => '/[^p{Ll}\p{Lu}\pL\pN]/' ) , 'spec' ) ; } }
Set up all validator according configuration file

@param $config
Set up all validator according configuration file