public static function getEnumById($enumId, $ignoreNotFound = false)
    {
        if ($enumId instanceof EnumId) {
            $enumId = $enumId->toString();
        }

        if (isset(self::$enums[$enumId])) {
            return self::$enums[$enumId];
        }

        if (!$ignoreNotFound) {
            throw new \RuntimeException(sprintf('Enum with id "%s" is invalid.', $enumId));
        }

        return null;
    }
public static function getEnumById($enumId, $ignoreNotFound = false)
    {
        if ($enumId instanceof EnumId) {
            $enumId = $enumId->toString();
        }

        if (isset(self::$enums[$enumId])) {
            return self::$enums[$enumId];
        }

        if (!$ignoreNotFound) {
            throw new \RuntimeException(sprintf('Enum with id "%s" is invalid.', $enumId));
        }

        return null;
    }
public static function getEnumById ( $ enumId , $ ignoreNotFound = false ) { if ( $ enumId instanceof EnumId ) { $ enumId = $ enumId -> toString ( ) ; } if ( isset ( self :: $ enums [ $ enumId ] ) ) { return self :: $ enums [ $ enumId ] ; } if ( ! $ ignoreNotFound ) { throw new \ RuntimeException ( sprintf ( 'Enum with id "%s" is invalid.' , $ enumId ) ) ; } return null ; }
Returns an enum by its id.

@param EnumId|string $enumId
@param bool          $ignoreNotFound

@return EnumDescriptor|null
Returns an enum by its id .