![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/medad.corals.io/vendor/kreait/firebase-php/src/Firebase/ |
<?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]; } }