<?php declare(strict_types=1); namespace Kreait\Firebase; use function getenv; use function in_array; use function putenv; /** * @internal * * @codeCoverageIgnore */ final class Util { /** * @param non-empty-string $name * * @return non-empty-string|null */ public static function getenv(string $name): ?string { $value = trim((string) ($_SERVER[$name] ?? $_ENV[$name] ?? getenv($name))); return $value !== '' ? $value : null; } /** * @param non-empty-string $name * @param non-empty-string $value */ public static function putenv(string $name, string $value): void { $_ENV[$name] = $value; $_SERVER[$name] = $value; putenv("{$name}={$value}"); } /** * @param non-empty-string $name */ public static function rmenv(string $name): void { unset($_ENV[$name], $_SERVER[$name]); putenv($name); } /** * @return non-empty-string|null */ public static function authEmulatorHost(): ?string { $emulatorHost = self::getenv('FIREBASE_AUTH_EMULATOR_HOST'); if (!in_array($emulatorHost, [null, ''], true)) { return $emulatorHost; } return null; } /** * @return non-empty-string|null */ public static function rtdbEmulatorHost(): ?string { $emulatorHost = self::getenv('FIREBASE_DATABASE_EMULATOR_HOST'); if (!in_array($emulatorHost, [null, ''], true)) { return $emulatorHost; } return null; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
AppCheck | Folder | 0755 |
|
|
Auth | Folder | 0755 |
|
|
Contract | Folder | 0755 |
|
|
Database | Folder | 0755 |
|
|
DynamicLink | Folder | 0755 |
|
|
Exception | Folder | 0755 |
|
|
Http | Folder | 0755 |
|
|
Messaging | Folder | 0755 |
|
|
RemoteConfig | Folder | 0755 |
|
|
Request | Folder | 0755 |
|
|
Util | Folder | 0755 |
|
|
Value | Folder | 0755 |
|
|
AppCheck.php | File | 1.32 KB | 0644 |
|
Auth.php | File | 22.53 KB | 0644 |
|
Database.php | File | 2.2 KB | 0644 |
|
DynamicLink.php | File | 2.04 KB | 0644 |
|
DynamicLinks.php | File | 5.26 KB | 0644 |
|
Factory.php | File | 20.57 KB | 0644 |
|
Firestore.php | File | 558 B | 0644 |
|
Messaging.php | File | 7.69 KB | 0644 |
|
RemoteConfig.php | File | 3.52 KB | 0644 |
|
Request.php | File | 131 B | 0644 |
|
Storage.php | File | 1.18 KB | 0644 |
|
Util.php | File | 1.55 KB | 0644 |
|