Determine if the given value is "blank".

@param  mixed  $value
@return bool
516215
public static function blank($value)
    {
        if (\is_null($value)) {
            return true;
        }

        if (\is_string($value)) {
            return trim($value) === '';
        }

        if (is_numeric($value) || \is_bool($value)) {
            return false;
        }

        if ($value instanceof \Countable) {
            return \count($value) === 0;
        }

        return empty($value);
    }
841500
public static function IS_TEXT($value = NULL) {
		$value		= self::flattenSingleValue($value);

		return (is_string($value) && !self::IS_ERROR($value));
	}
36348
private function isEmpty($value)
    {
        // Assume that the value is empty
        $empty = true;

        // If the value is an array
        if (is_array($value)) {
            foreach ($value as $element) {
                // The value is empty if all elements of the array are empty
                $empty = $empty && $this->isEmpty($element);
            }
        } else {
            // We can't use the empty function here because it treats "0" as empty
            $empty = strlen($value) == 0;
        }

        return $empty;
    }
788224
public function isValueValid($value) {
		return $value instanceof Type\ListItem || $value instanceof DataType\TextType || $value instanceof Type\Thing;
	}
967999
public function isValid($value)
    {
        if (!is_string($value) && !is_int($value) && !is_float($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $this->_setValue((string) $value);

        if ('' === $this->_value) {
            $this->_error(self::STRING_EMPTY);
            return false;
        }

        if (null === self::$_filter) {

            self::$_filter = new Zend_Filter_Digits();
        }

        if ($this->_value !== self::$_filter->filter($this->_value)) {
            $this->_error(self::NOT_DIGITS);
            return false;
        }

        return true;
    }
762050
public function isEmpty($value)
    {
        return empty($value) && (is_array($value) || is_object($value) || strlen(trim($value)) === 0);
    }
782286
public function isValid($value)
    {
        $this->_setValue($value);
        $token = $this->getToken();

        if (empty($token)) {
            $this->_error(self::MISSING_TOKEN);
            return false;
        }

        if ($value !== $token) {
            $this->_error(self::NOT_SAME);
            return false;
        }

        return true;
    }
565776
public function isEmpty($value): bool
    {
        foreach ($value->getDefinition()->getFields() as $name => $field) {
            if (!$field->isEmpty($value->{$name})) {
                return false;
            }
        }

        return true;
    }
431178
public static function toBooleanValue(string $value): bool
    {
        if (empty($value)) {
            return false;
        }
        
        return !in_array(strtolower(trim($value)), StringUtils::FALSES);
    }
1083679
protected function isSelected($value)
    {
        $selectedValue = $this->getSelectedValue();
        if ($value === $selectedValue || (string)$value === $selectedValue) {
            return true;
        }
        if ($this->hasArgument('multiple')) {
            if ($selectedValue === null && $this->arguments['selectAllByDefault'] === true) {
                return true;
            } elseif (is_array($selectedValue) && in_array($value, $selectedValue)) {
                return true;
            }
        }
        return false;
    }
502696
public function _isValueIndexable($value)
    {
        return (
            is_string($value)
            || is_null($value)
            || is_bool($value)
            || is_integer($value)
        );
    }
1309227
protected function validCache($value)
    {
        if (is_null($value) || !is_array($value) || empty($value)) {
            return false;
        }

        return true;
    }
920484
public function isValid($value)
    {
        $result = filter_var($value, FILTER_VALIDATE_EMAIL);
        if (!$result) {
            $this->addMessage('email');
        }
        return (boolean) $result;
    }
204622
public function isValid($value)
    {
        $this->databaseError = null;

        // Empty connection string is valid (defaults to localhost:defaultPort)
        if (!empty($value) && !preg_match($this->pattern, $value)) {
            $this->error(self::INVALID);

            return false;
        }

        return true;
    }
698285
public function isValueValid($value) {
		return $value instanceof DataType\TextType || $value instanceof Type\Thing || $value instanceof DataType\URLType;
	}
253849
private function check($value) {

		if(true === is_string($value)) {
			return false !== filter_var(trim($value), \FILTER_VALIDATE_EMAIL);
		}

		return false;
	}
1221721
public function isValid($value)
    {
        if ($this->skipValidation)
            return true;

        $datatype = $this->validation['datatype'];

        //NULL check, empty strings are considered null
        if(in_array($datatype, array('string', 'url', 'email', 'slug', 'slugwithslash', 'html', 'binary','json'))
          && strlen(trim($value)) == 0)
            $value = null;

        if ($this->validation['nullable'] === false && $value === null && $datatype != 'boolean') {
            $this->failureCode = 'nullable';
            $this->failureMessage = 'cannot be empty';
            return false;
        }

        //Nothing more to validate if the value is null...
        if ($value === null)
            return true;


        //Check date makes sense
        if ($datatype === 'date') {

            //todo: not sure how to check validity of date... it's already a DateTime instance.
            if (false) {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is an invalid date';
                return false;
            }
        }


        //Validate MIN
        $min = $this->validation['min'];

        if ($min != null) {
            if ($datatype === 'float') {
                if($value < floatval($min)) {
                    $this->failureCode = 'min';
                    $this->failureMessage = 'is less than the minimum value';
                    return false;
                }
            } else if ($datatype === 'int') {
                if($value < intval($min)) {
                    $this->failureCode = 'min';
                    $this->failureMessage = 'is less than the minimum value';
                    return false;
                }
            } else {

                if (is_string($value) && strlen($value) < intval($min)) {
                    $this->failureCode = 'minlength';
                    $this->failureMessage = 'must be at least '.($min).' characters';
                    return false;
                }
            }
        }


        //Validate MAX
        $max = $this->validation['max'];

        if ($max != null) {
            if ($datatype === 'float') {
                if($value > floatval($max)) {
                    $this->failureCode = 'max';
                    $this->failureMessage = 'is more than the maximum value';
                    return false;
                }
            } else if ($datatype === 'int') {
                if($value > intval($max)) {
                    $this->failureCode = 'max';
                    $this->failureMessage = 'is more than the maximum value';
                    return false;
                }
            } else {

                $maxbytes = intval($max);

                if(intval($max) < 255)
                {
                    // count characters

                    if (is_string($value) && StringUtils::charCount($value) > intval($max)) {
                        $this->failureCode = 'maxlength';
                        $this->failureMessage = 'must be a maximum of '.($max).' characters';
                        return false;
                    }

                    $maxbytes = 255;

                }

                // count bytes
                if (is_string($value) && StringUtils::byteCount($value) > intval($maxbytes)) {
                    $this->failureCode = 'maxlength';
                    $this->failureMessage = 'must be a maximum of '.($maxbytes).' bytes';
                    return false;
                }
            }
        }

        if($datatype === 'slug')
        {
            if(!SlugUtils::isSlug($value, false))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid slug, cannot contain slashes';
                return false;
            }
        }

        if($datatype === 'slugwithslash')
        {
            if(!SlugUtils::isSlug($value, true))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid slug';
                return false;
            }
        }

        if($datatype === 'url')
        {
            if(!URLUtils::isUrl($value))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid URL';
                return false;
            }
        }

        if($datatype === 'email')
        {
            if(!EmailUtils::isEmailAddress($value))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid email address';
                return false;
            }
        }

        if($datatype === 'json')
        {
            if(!JSONUtils::isValid($value)) //todo: get exact error message here
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid json string';
                return false;
            }
        }

        //Validate MATCH expression
        $match = $this->validation['match'];

        if ($match != null) {
            // Automatically escape unescaped slashes in the match before running it
            $match = preg_replace('/([^\\\\])\//', '$1\\/', $match);

            if (preg_match('/'.$match.'/s', $value) === 0) {
                $this->failureCode = 'invalid';
                //$this->failureMessage = 'is invalid (' . substr($value, 0, 255) . ')';
                $this->failureMessage = 'is invalid';
                return false;
            }
        }

        // Validate all custom functions
        foreach ( $this->validation['callback'] as $callback ) {
            if (!empty($callback) && call_user_func($callback, $value) === false) {
                $this->failureCode = $callback;
                $this->failureMessage = 'is invalid';
                return false;
            }
        }

        return true;
    }