Compares this enum (which has a value) to the value provided.  If the value
is itself an Enum then we'll get the value of the provided enum and compare
it to our value.

@param Enum|int|string $value

@return bool
349051
final public function equals($value)
    {
        if ($value instanceof Enum) {
            return $this->value == $value->getValue();
        }
        return $this->value == $value;
    }
1318990
public function validate($value)
    {
        if ($this->isa) {
            $test = ValueType::test($value, $this->isa, $this->isaOption);
            if ($test === false) {
                return false;
            }

            if ($test === true) {
                $value = ValueType::parse();
            }
        }

        if (
            ($validValues = $this->getValidValues()) &&
            !\in_array($value, $validValues, true)
        ) {
            return false;
        }

        if (
            $this->validator &&
            !($this->validator)($value)
        ) {
            return false;
        }

        $this->value = $value;

        return true;
    }
931253
public function isValid($value)
    {
        if (!is_string($value) && !is_int($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $this->_setValue($value);
        if (!ctype_xdigit((string) $value)) {
            $this->_error(self::NOT_HEX);
            return false;
        }

        return true;
    }
103635
public static function enum($value, $options){

		$value = static::_nullValue($value);

		if(!in_array($value, $options)){

			return null;
		}

		return $value;
	}
882876
public static function fromValue($value)
    {
        $values = static::getValues();
        if (array_key_exists($value, $values)) {
            return new static($values[$value], $value);
        }
        throw new \InvalidArgumentException("No enum constant value '$value' class " . get_called_class());
    }
950210
public function isValueValid($value) {
		return $value instanceof DataType\BooleanType || $value instanceof DataType\NumberType || $value instanceof Type\StructuredValueType || $value instanceof DataType\TextType;
	}
152909
public function evaluate($value) {
		switch ($this->comparison) {
			case '':
			case '=':
				foreach ($this->value as $value_item) {
					if ($value_item == $value) {
						return true;
					}
				}
				return false;
			case '!=':
			case '<>':
				foreach ($this->value as $value_item) {
					if ($value_item != $value) {
						return true;
					}
				}
				return false;
			case '<':
				foreach ($this->value as $value_item) {
					if ($value_item < $value) {
						return true;
					}
				}
				return false;
			case '>':
				foreach ($this->value as $value_item) {
					if ($value_item > $value) {
						return true;
					}
				}
				return false;
			case '<=':
				foreach ($this->value as $value_item) {
					if ($value_item <= $value) {
						return true;
					}
				}
				return false;
			case '>=':
				foreach ($this->value as $value_item) {
					if ($value_item >= $value) {
						return true;
					}
				}
				return false;
			default:
				throw new \Exception("Unsupported comparison operator: '" . $this->comparison . "'");
		}
	}
640859
public function equals($value) {
        if ($value instanceof PHPString) {
            $value = $value->getValue();
        }
        return strcmp($this->value, $value) === 0;
    }
1231065
public static function validate($value)
    {
        $reflector = new ReflectionClass(static::class);

        foreach ($reflector->getConstants() as $allowedValue) {
            if ($value === $allowedValue) {
                return $allowedValue;
            }
        }

        throw new ArgumentException(
            sprintf(
                'Invalid value `%s` on enum `%s`',
                $value,
                static::class
            )
        );
    }
234711
function checkType($value)
    {
        if( $this->type !== null ) {
            // check type constraints
            if( $this->isTypeInteger() ) {
                if( ! is_numeric($value) )
                    throw new NonNumericException;
                $value = (int) $value;
            }
        }
        return $value;
    }
96204
public function isValueValid($value) {
		return $value instanceof DataType\NumberType || $value instanceof Type\QuantitativeValue || $value instanceof DataType\TextType;
	}
793889
public static function isInt($value) {
        if(is_object($value)) {
            $value = Assert::isString($value);
        }
        if(is_int($value)) {
            return $value;
        } elseif(is_scalar($value) && preg_match('@^-?[0-9]+$@', $value)) {
            return (int)$value;
        } else {
            throw new \InvalidArgumentException('Must be Int: ' . print_r($value, true));
        }
    }
569448
public function coerce($value)
    {
        $enumValue = $this->getValueLookup()[$value];
        return $enumValue ? $enumValue->getName() : NULL;
    }
1265245
public function acceptsValue($value): bool {
		switch ($this->operator) {
			case CriteriaComparator::OPERATOR_NOT_IN:
				if ($value === null) return true;
				return !$this->in($value);
			case CriteriaComparator::OPERATOR_IN:
				if ($value === null) return false;
				return !$this->in($value);
				
			case CriteriaComparator::OPERATOR_CONTAINS_NOT:
				ArgUtils::assertTrue(is_array($value));
				
				foreach ($value as $relationEntry) {
					if ($this->in($relationEntry)) return false;
				}
				
				return true;
			case CriteriaComparator::OPERATOR_CONTAINS:
				ArgUtils::assertTrue(is_array($value));
				
				foreach ($value as $relationEntry) {
					if (!$this->in($relationEntry)) return false;
				}
				
				return true;
		}
	}
219816
public function extract($value)
    {
        if ($value instanceof Enum && get_class($value) === $this->classFqn) {
            return (string)$value;
        }

        return $value;
    }
1071387
public function setCompareAttribute($value)
    {
        $this->compareAttribute = trim($value) === '' ? null : trim($value);

        return $this;
    }
142546
public static function isValid($value)
    {
        if (is_string($value)) {
            $value = [ $value ];
        }
        
        if (!is_array($value) || count($value) === 0) {
            return false;
        }

        foreach ($value as $ep) {
            if (!is_string($ep)) {
                return false;
            }
            $type = self::getType($ep);

            if ($type === null) {
                return false;
            }
        }
        return true;
    }