<?php declare(strict_types=1); namespace Kreait\Firebase; use Google\Cloud\Storage\Bucket; use Google\Cloud\Storage\StorageClient; use Kreait\Firebase\Exception\RuntimeException; use function array_key_exists; /** * @internal */ final class Storage implements Contract\Storage { private StorageClient $storageClient; private ?string $defaultBucket; /** @var Bucket[] */ private array $buckets = []; public function __construct(StorageClient $storageClient, ?string $defaultBucket = null) { $this->storageClient = $storageClient; $this->defaultBucket = $defaultBucket; } public function getStorageClient(): StorageClient { return $this->storageClient; } public function getBucket(?string $name = null): Bucket { $name = $name ?: $this->defaultBucket; if ($name === null) { throw new RuntimeException( 'No bucket name was given and no default bucked was configured.', ); } if (!array_key_exists($name, $this->buckets)) { $this->buckets[$name] = $this->storageClient->bucket($name); } return $this->buckets[$name]; } }
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 |
|