public function setName($name)
    {
        if (is_scalar($name) || method_exists($name, '__toString')) {
            $this->name = (string) $name;
        } else {
            throw new InvalidArgumentException('The name must be a string.');
        }

        if ($this->name === '') {
            $this->name = 'Error';
        }

        return $this;
    }
public function setName($name)
    {
        if (is_scalar($name) || method_exists($name, '__toString')) {
            $this->name = (string) $name;
        } else {
            throw new InvalidArgumentException('The name must be a string.');
        }

        if ($this->name === '') {
            $this->name = 'Error';
        }

        return $this;
    }
public function setName ( $ name ) { if ( is_scalar ( $ name ) || method_exists ( $ name , '__toString' ) ) { $ this -> name = ( string ) $ name ; } else { throw new InvalidArgumentException ( 'The name must be a string.' ) ; } if ( $ this -> name === '' ) { $ this -> name = 'Error' ; } return $ this ; }
Set the error name.

@param string $name the error name

@throws \InvalidArgumentException

@return $this
Set the error name .