public function isValid(array $values)
    {
        $this->errorMessages = [];
        
        foreach ($this->elements->getElements() as $element) {
            $elementId = $element->getID();
            if (empty($elementId)) {
                continue;
            }
            
            $value = null;
            if (array_key_exists($elementId, $values)) {
                $value = $values[$elementId];
            }
            $element->setValue($value);
            
            $this->filterElement($element);
            $this->validateElement($element);
        }
        
        return count($this->errorMessages) === 0;
    }
public function isValid(array $values)
    {
        $this->errorMessages = [];
        
        foreach ($this->elements->getElements() as $element) {
            $elementId = $element->getID();
            if (empty($elementId)) {
                continue;
            }
            
            $value = null;
            if (array_key_exists($elementId, $values)) {
                $value = $values[$elementId];
            }
            $element->setValue($value);
            
            $this->filterElement($element);
            $this->validateElement($element);
        }
        
        return count($this->errorMessages) === 0;
    }
public function isValid ( array $ values ) { $ this -> errorMessages = [ ] ; foreach ( $ this -> elements -> getElements ( ) as $ element ) { $ elementId = $ element -> getID ( ) ; if ( empty ( $ elementId ) ) { continue ; } $ value = null ; if ( array_key_exists ( $ elementId , $ values ) ) { $ value = $ values [ $ elementId ] ; } $ element -> setValue ( $ value ) ; $ this -> filterElement ( $ element ) ; $ this -> validateElement ( $ element ) ; } return count ( $ this -> errorMessages ) === 0 ; }
Validates all the elements against the defined validators.

During validation the given values will be set as the new values of the elements.

@param array $values
@return bool
Validates all the elements against the defined validators .