From 04885187d6dbeac9c929fa860b0d62735fcab2d6 Mon Sep 17 00:00:00 2001 From: CinPer Date: Tue, 18 Aug 2020 10:15:14 +0000 Subject: [PATCH] Fix rename method envVariableExists to envVariableExistsInMemory --- src/Dotenv.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/Dotenv.php b/src/Dotenv.php index 4eaf8e7..270e55a 100644 --- a/src/Dotenv.php +++ b/src/Dotenv.php @@ -74,12 +74,12 @@ public function get($name = '', $default = null) $lastIndex = count($nameExploded) - 1; foreach ($nameExploded as $key => $variableName) { - if (! $variableName) { + if (!$variableName) { return null; } if (isset($lookup[$variableName])) { - if (! is_array($value) && $key < $lastIndex) { + if (!is_array($value) && $key < $lastIndex) { return null; } @@ -140,11 +140,11 @@ public function persist($name, $value, $overwrite = true, $quoteString = true) $content = preg_replace($pattern, $line, $content); } elseif ( ($envVariableExistsInMemory && $overwrite) || - ! $envVariableExistsInMemory || - ! $envVariableExistsInFile + !$envVariableExistsInMemory || + !$envVariableExistsInFile ) { $content = trim($content)."\n\n".$line; - } elseif (($envVariableExistsInMemory || $envVariableExistsInFile) && ! $overwrite) { + } elseif (($envVariableExistsInMemory || $envVariableExistsInFile) && !$overwrite) { return; } @@ -171,7 +171,7 @@ protected function replaceReferences() if (preg_match($pattern, $line, $matches)) { $ref = $matches[3]; - if (! $this->envVariableExists($ref)) { + if (!$this->envVariableExistsInMemory($ref)) { return null; } @@ -232,9 +232,9 @@ protected function valueSameAsReference($refValue, $lineValue) protected function isStringifiable($var) { return - ! is_array($var) && - ((! is_object($var) && settype($var, 'string') !== false) || - (is_object($var) && method_exists($var, '__toString'))); + !is_array($var) && + ((!is_object($var) && settype($var, 'string') !== false) || + (is_object($var) && method_exists($var, '__toString'))); } /** @@ -275,10 +275,6 @@ protected function envVariableExistsInMemory($name) return isset($this->env[$name]) || (bool) getenv($name); } - public function variableExistsInEnvFile($name) - { - } - /** * Get the line number of a string, in a file. * @@ -309,14 +305,14 @@ protected function getLineWithString($fileName, $str) */ protected function addIfNotExists($name, $value, $section = '') { - if (! isset($this->env[$name])) { + if (!isset($this->env[$name])) { $this->add($name, $value, $section); } } public function setPath($path) { - if (! \file_exists($path)) { + if (!\file_exists($path)) { throw new \Exception('Trying to set the env file path but the file '.$path.' seems not to exist.'); }