Assert\Assertion::notBlank PHP Method

notBlank() public static method

Assert that value is not blank
public static notBlank ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
return boolean
    public static function notBlank($value, $message = null, $propertyPath = null)
    {
        if (false === $value || empty($value) && '0' != $value || is_string($value) && '' === trim($value)) {
            $message = sprintf($message ?: 'Value "%s" is blank, but was expected to contain a value.', static::stringify($value));
            throw static::createException($value, $message, static::INVALID_NOT_BLANK, $propertyPath);
        }
        return true;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param string $name
  */
 protected function setName($name)
 {
     Assertion::string($name);
     Assertion::notBlank($name);
     $this->attributes['name'] = $name;
     $this->name = $name;
 }
All Usage Examples Of Assert\Assertion::notBlank