Skip to content

Commit

Permalink
Merge pull request #4 from prinx/analysis-9mlvN9
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
prinx authored Aug 18, 2020
2 parents 0488518 + 8f1e9df commit c713e8d
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 @@ -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;
}

Expand Down Expand Up @@ -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;
}

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

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

Expand Down Expand Up @@ -232,8 +232,8 @@ protected function valueSameAsReference($refValue, $lineValue)
protected function isStringifiable($var)
{
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 @@ -305,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.');
}

Expand Down

0 comments on commit c713e8d

Please sign in to comment.