Skip to content

Commit

Permalink
Yoda style
Browse files Browse the repository at this point in the history
  • Loading branch information
prinx committed Jul 28, 2020
1 parent d9f3225 commit 89508da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($path = '')
$this->env = \parse_ini_file($this->path, true, INI_SCANNER_TYPED);
$this->env = array_merge($_ENV, $this->env);
} catch (\Throwable $th) {
throw new \Exception('An error happened when parsing the .env file: ' . $th->getMessage());
throw new \Exception('An error happened when parsing the <strong>.env</strong> file:<br>' . $th->getMessage());
}

$this->replaceReferences();
Expand Down Expand Up @@ -179,7 +179,7 @@ public function add($name, $value)

$namespace_count = count($name_exploded);

if ($namespace_count === 1) {
if (1 === $namespace_count) {
return $this->env[$name] = $value;
}

Expand Down
6 changes: 3 additions & 3 deletions src/env.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
* @param mixed $default
* @return mixed
*/
function env($name = null, $default = null)
function env($key = null, $default = null)
{
$env = DotenvInstance::get();

switch (\func_num_args()) {
case 0:
return \call_user_func([$env, 'all']);
case 1:
return \call_user_func([$env, 'get'], $name);
return \call_user_func([$env, 'get'], $key);

default:
return \call_user_func([$env, 'get'], $name, $default);
return \call_user_func([$env, 'get'], $key, $default);
}
}

Expand Down

0 comments on commit 89508da

Please sign in to comment.