public function addError($key, $error) {
        if (is_array($key)) {
            $key = implode('_', $key);
        }

        if (array_key_exists($key, $this->errors)) {
            $this->errors[$key][] = $error;
        }
        else {
            $this->errors[$key] = array($error);
        }
    }
public function addError($key, $error) {
        if (is_array($key)) {
            $key = implode('_', $key);
        }

        if (array_key_exists($key, $this->errors)) {
            $this->errors[$key][] = $error;
        }
        else {
            $this->errors[$key] = array($error);
        }
    }
public function addError ( $ key , $ error ) { if ( is_array ( $ key ) ) { $ key = implode ( '_' , $ key ) ; } if ( array_key_exists ( $ key , $ this -> errors ) ) { $ this -> errors [ $ key ] [ ] = $ error ; } else { $ this -> errors [ $ key ] = array ( $ error ) ; } }
Adds the specified errorMessage to the Errors instance that is associated with the specified key.

@param string $key The key of state to add error.
@param mixed $error The error or error message to add.

@return void
Adds the specified errorMessage to the Errors instance that is associated with the specified key .