public function getErrors($asFlat = false)
    {
        $iterator = true === $asFlat
            ? $this->getRecursiveIterator()
            : $this;

        $errors = array();
		foreach ($iterator as $element) {
    		if ($element->getType() == self::TYPE_ERROR) {
                $errors[] = $element;
            }
		}
		return $errors;
	}
public function getErrors($asFlat = false)
    {
        $iterator = true === $asFlat
            ? $this->getRecursiveIterator()
            : $this;

        $errors = array();
		foreach ($iterator as $element) {
    		if ($element->getType() == self::TYPE_ERROR) {
                $errors[] = $element;
            }
		}
		return $errors;
	}
public function getErrors ( $ asFlat = false ) { $ iterator = true === $ asFlat ? $ this -> getRecursiveIterator ( ) : $ this ; $ errors = array ( ) ; foreach ( $ iterator as $ element ) { if ( $ element -> getType ( ) == self :: TYPE_ERROR ) { $ errors [ ] = $ element ; } } return $ errors ; }
returns all error elements

@param bool $asFlat
@return array
returns all error elements