src/Plista/Core/Enum.php
public final function equals($e) {
		// first we check the case when an Enum is passed in
		if (is_object($e)) {
			// we require it to be the same type, even when the value may be identical
			if (!($e instanceof static)) {
				return false;
			}

			// strict check
			return $this->value === $e->value;
		}

		// if its a scalar value, we check it directly, still using strict
		// this will usually happen if the used does something like this:
		// $enum = EnumChild::FOO();
		// if ($enum->equals(EnumChild::FOO)) ...
		return $this->value === $e;
	}
public final function equals($e) {
		// first we check the case when an Enum is passed in
		if (is_object($e)) {
			// we require it to be the same type, even when the value may be identical
			if (!($e instanceof static)) {
				return false;
			}

			// strict check
			return $this->value === $e->value;
		}

		// if its a scalar value, we check it directly, still using strict
		// this will usually happen if the used does something like this:
		// $enum = EnumChild::FOO();
		// if ($enum->equals(EnumChild::FOO)) ...
		return $this->value === $e;
	}
public final function equals ( $ e ) { // first we check the case when an Enum is passed in if ( is_object ( $ e ) ) { // we require it to be the same type, even when the value may be identical if ( ! ( $ e instanceof static ) ) { return false ; } // strict check return $ this -> value === $ e -> value ; } // if its a scalar value, we check it directly, still using strict // this will usually happen if the used does something like this: // $enum = EnumChild::FOO(); // if ($enum->equals(EnumChild::FOO)) ... return $ this -> value === $ e ; }
Helper function to compare an Enum instance to another Enum instance or a scalar value.

@param Enum|string|int $e the value to compare against
@return bool
Helper function to compare an Enum instance to another Enum instance or a scalar value .