public function validate($data = null)
    {
        if ($data !== null) {
            $this->setData($data);
        }
        // data was already validated, return the results immediately
        if ($this->wasValidated === true) {
            return $this->wasValidated && count($this->messages) === 0;
        }
        foreach ($this->rules as $selector => $valueValidator) {
            foreach ($this->getDataWrapper()->getItemsBySelector($selector) as $valueIdentifier => $value) {
                /* @var $valueValidator \Sirius\Validation\ValueValidator */
                if (!$valueValidator->validate($value, $valueIdentifier, $this->getDataWrapper())) {
                    foreach ($valueValidator->getMessages() as $message) {
                        $this->addMessage($valueIdentifier, $message);
                    }
                }
            }
        }
        $this->wasValidated = true;

        return $this->wasValidated && count($this->messages) === 0;
    }
public function validate($data = null)
    {
        if ($data !== null) {
            $this->setData($data);
        }
        // data was already validated, return the results immediately
        if ($this->wasValidated === true) {
            return $this->wasValidated && count($this->messages) === 0;
        }
        foreach ($this->rules as $selector => $valueValidator) {
            foreach ($this->getDataWrapper()->getItemsBySelector($selector) as $valueIdentifier => $value) {
                /* @var $valueValidator \Sirius\Validation\ValueValidator */
                if (!$valueValidator->validate($value, $valueIdentifier, $this->getDataWrapper())) {
                    foreach ($valueValidator->getMessages() as $message) {
                        $this->addMessage($valueIdentifier, $message);
                    }
                }
            }
        }
        $this->wasValidated = true;

        return $this->wasValidated && count($this->messages) === 0;
    }
public function validate ( $ data = null ) { if ( $ data !== null ) { $ this -> setData ( $ data ) ; } // data was already validated, return the results immediately if ( $ this -> wasValidated === true ) { return $ this -> wasValidated && count ( $ this -> messages ) === 0 ; } foreach ( $ this -> rules as $ selector => $ valueValidator ) { foreach ( $ this -> getDataWrapper ( ) -> getItemsBySelector ( $ selector ) as $ valueIdentifier => $ value ) { /* @var $valueValidator \Sirius\Validation\ValueValidator */ if ( ! $ valueValidator -> validate ( $ value , $ valueIdentifier , $ this -> getDataWrapper ( ) ) ) { foreach ( $ valueValidator -> getMessages ( ) as $ message ) { $ this -> addMessage ( $ valueIdentifier , $ message ) ; } } } } $ this -> wasValidated = true ; return $ this -> wasValidated && count ( $ this -> messages ) === 0 ; }
Performs the validation

@param mixed $data
array to be validated

@return boolean
Performs the validation