<?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; use PhpOption\None; final class MultiReader implements ReaderInterface { /** * The set of readers to use. * * @var \Dotenv\Repository\Adapter\ReaderInterface[] */ private $readers; /** * Create a new multi-reader instance. * * @param \Dotenv\Repository\Adapter\ReaderInterface[] $readers * * @return void */ public function __construct(array $readers) { $this->readers = $readers; } /** * Read an environment variable, if it exists. * * @param non-empty-string $name * * @return \PhpOption\Option<string> */ public function read(string $name) { foreach ($this->readers as $reader) { $result = $reader->read($name); if ($result->isDefined()) { return $result; } } return None::create(); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
AdapterInterface.php | File | 361 B | 0644 |
|
ApacheAdapter.php | File | 2.01 KB | 0644 |
|
ArrayAdapter.php | File | 1.65 KB | 0644 |
|
EnvConstAdapter.php | File | 1.98 KB | 0644 |
|
GuardedWriter.php | File | 1.91 KB | 0644 |
|
ImmutableWriter.php | File | 2.59 KB | 0644 |
|
MultiReader.php | File | 1017 B | 0644 |
|
MultiWriter.php | File | 1.33 KB | 0644 |
|
PutenvAdapter.php | File | 1.94 KB | 0644 |
|
ReaderInterface.php | File | 317 B | 0644 |
|
ReplacingWriter.php | File | 2.26 KB | 0644 |
|
ServerConstAdapter.php | File | 2 KB | 0644 |
|
WriterInterface.php | File | 545 B | 0644 |
|