From 110dc2831488937c1afb70c11657a341912fc8cd Mon Sep 17 00:00:00 2001 From: Peter Nguyen Date: Wed, 5 Feb 2025 00:44:12 -0600 Subject: Initial commit 2/25/2025 --- .../phpdotenv/src/Repository/AdapterRepository.php | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php (limited to 'vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php') diff --git a/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php b/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php new file mode 100644 index 0000000..e4b8fb7 --- /dev/null +++ b/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php @@ -0,0 +1,107 @@ +reader = $reader; + $this->writer = $writer; + } + + /** + * Determine if the given environment variable is defined. + * + * @param string $name + * + * @return bool + */ + public function has(string $name) + { + return '' !== $name && $this->reader->read($name)->isDefined(); + } + + /** + * Get an environment variable. + * + * @param string $name + * + * @throws \InvalidArgumentException + * + * @return string|null + */ + public function get(string $name) + { + if ('' === $name) { + throw new InvalidArgumentException('Expected name to be a non-empty string.'); + } + + return $this->reader->read($name)->getOrElse(null); + } + + /** + * Set an environment variable. + * + * @param string $name + * @param string $value + * + * @throws \InvalidArgumentException + * + * @return bool + */ + public function set(string $name, string $value) + { + if ('' === $name) { + throw new InvalidArgumentException('Expected name to be a non-empty string.'); + } + + return $this->writer->write($name, $value); + } + + /** + * Clear an environment variable. + * + * @param string $name + * + * @throws \InvalidArgumentException + * + * @return bool + */ + public function clear(string $name) + { + if ('' === $name) { + throw new InvalidArgumentException('Expected name to be a non-empty string.'); + } + + return $this->writer->delete($name); + } +} -- cgit v1.2.3