Skip to content

Commit be2a943

Browse files
CS fixes
1 parent cbd7fa3 commit be2a943

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/Loader.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Loader
2626
*
2727
* @var bool
2828
*/
29-
protected $immutable = false;
29+
protected $immutable;
3030

3131
/**
3232
* Create a new loader instance.
@@ -54,10 +54,7 @@ public function load()
5454
$filePath = $this->filePath;
5555
$lines = $this->readLinesFromFile($filePath);
5656
foreach ($lines as $line) {
57-
if ($this->isComment($line)) {
58-
continue;
59-
}
60-
if ($this->looksLikeSetter($line)) {
57+
if (!$this->isComment($line) && $this->looksLikeSetter($line)) {
6158
$this->setEnvironmentVariable($line);
6259
}
6360
}
@@ -98,6 +95,7 @@ protected function normaliseEnvironmentVariable($name, $value)
9895
list($name, $value) = $this->splitCompoundStringIntoParts($name, $value);
9996
list($name, $value) = $this->sanitiseVariableName($name, $value);
10097
list($name, $value) = $this->sanitiseVariableValue($name, $value);
98+
10199
$value = $this->resolveNestedVariables($value);
102100

103101
return array($name, $value);
@@ -333,11 +331,12 @@ public function setEnvironmentVariable($name, $value = null)
333331

334332
// Don't overwrite existing environment variables if we're immutable
335333
// Ruby's dotenv does this with `ENV[key] ||= value`.
336-
if ($this->immutable === true && $this->getEnvironmentVariable($name) !== null) {
334+
if ($this->immutable && $this->getEnvironmentVariable($name) !== null) {
337335
return;
338336
}
339337

340338
putenv("$name=$value");
339+
341340
$_ENV[$name] = $value;
342341
$_SERVER[$name] = $value;
343342
}
@@ -361,10 +360,12 @@ public function setEnvironmentVariable($name, $value = null)
361360
public function clearEnvironmentVariable($name)
362361
{
363362
// Don't clear anything if we're immutable.
364-
if (!$this->immutable) {
365-
putenv($name);
366-
unset($_ENV[$name]);
367-
unset($_SERVER[$name]);
363+
if ($this->immutable) {
364+
return;
368365
}
366+
367+
putenv($name);
368+
369+
unset($_ENV[$name], $_SERVER[$name]);
369370
}
370371
}

src/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function notEmpty()
5656
{
5757
return $this->assertCallback(
5858
function ($value) {
59-
return (strlen(trim($value)) > 0);
59+
return strlen(trim($value)) > 0;
6060
},
6161
'is empty'
6262
);

0 commit comments

Comments
 (0)