public function prependValidator(ValidatorInterface $validator,
                                     $showMessages = true,
                                     $leadingTemplate = null,
                                     $trailingTemplate = null)
    {
        $priority = self::DEFAULT_PRIORITY;
        if (!$this->validators->isEmpty()) {
            $queue = $this->validators->getIterator();
            $queue->setExtractFlags(PriorityQueue::EXTR_PRIORITY);
            $extractedNode = $queue->extract();
            $priority = $extractedNode[0] + 1;
        }
    
        $this->validators->insert(
            array(
                'instance' => $validator,
                'show_messages' => (bool) $showMessages,
                'leading_message_template' => $leadingTemplate,
                'trailing_message_template' => $trailingTemplate,
            ),
            $priority
        );
        return $this;
    }
public function prependValidator(ValidatorInterface $validator,
                                     $showMessages = true,
                                     $leadingTemplate = null,
                                     $trailingTemplate = null)
    {
        $priority = self::DEFAULT_PRIORITY;
        if (!$this->validators->isEmpty()) {
            $queue = $this->validators->getIterator();
            $queue->setExtractFlags(PriorityQueue::EXTR_PRIORITY);
            $extractedNode = $queue->extract();
            $priority = $extractedNode[0] + 1;
        }
    
        $this->validators->insert(
            array(
                'instance' => $validator,
                'show_messages' => (bool) $showMessages,
                'leading_message_template' => $leadingTemplate,
                'trailing_message_template' => $trailingTemplate,
            ),
            $priority
        );
        return $this;
    }
public function prependValidator ( ValidatorInterface $ validator , $ showMessages = true , $ leadingTemplate = null , $ trailingTemplate = null ) { $ priority = self :: DEFAULT_PRIORITY ; if ( ! $ this -> validators -> isEmpty ( ) ) { $ queue = $ this -> validators -> getIterator ( ) ; $ queue -> setExtractFlags ( PriorityQueue :: EXTR_PRIORITY ) ; $ extractedNode = $ queue -> extract ( ) ; $ priority = $ extractedNode [ 0 ] + 1 ; } $ this -> validators -> insert ( array ( 'instance' => $ validator , 'show_messages' => ( bool ) $ showMessages , 'leading_message_template' => $ leadingTemplate , 'trailing_message_template' => $ trailingTemplate , ) , $ priority ) ; return $ this ; }
Adds validator to beginning of chain.

@param ValidatorInterface $validator
@param boolean            $showMessages     Show messages for this
validator on failure.
@param string|null        $leadingTemplate  Validator's leading message
template.
@param string|null        $trailingTemplate Validator's trailing message
template.
@return self
Adds validator to beginning of chain .