Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/prinx/dotenv into main
Browse files Browse the repository at this point in the history
  • Loading branch information
prinx committed May 18, 2021
2 parents a415a1b + e44553e commit faa3c09
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public function get(string $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;
}

Expand Down Expand Up @@ -139,11 +139,11 @@ public function persist(string $name, $value, bool $overwrite = true, bool $quot
$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 $this;
}

Expand All @@ -165,7 +165,7 @@ public static function load($path)
*/
protected function replaceReferences()
{
if (!\file_exists($this->path)) {
if (! \file_exists($this->path)) {
return $this;
}

Expand All @@ -176,7 +176,7 @@ protected function replaceReferences()
if (preg_match($pattern, $line, $matches)) {
$ref = $matches[3];

if (!$this->envVariableExistsInMemory($ref)) {
if (! $this->envVariableExistsInMemory($ref)) {
continue;
}

Expand Down Expand Up @@ -237,8 +237,8 @@ protected function valueSameAsReference($refValue, $lineValue): bool
protected function isStringifiable($var): bool
{
return
!is_array($var) &&
((!is_object($var) && settype($var, 'string') !== false) ||
! is_array($var) &&
((! is_object($var) && settype($var, 'string') !== false) ||
(is_object($var) && method_exists($var, '__toString')));
}

Expand Down Expand Up @@ -303,7 +303,7 @@ protected function getLineWithString(string $fileName, string $str)
*/
protected function addIfNotExists(string $name, $value, string $section = '')
{
if (!isset($this->env[$name])) {
if (! isset($this->env[$name])) {
$this->add($name, $value, $section);
}

Expand Down

0 comments on commit faa3c09

Please sign in to comment.