Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
fixes #389 (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Sep 21, 2016
1 parent 1fa7fbe commit ad5e5c8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
"yosymfony/toml" : "^0.3"
},
"autoload": {
"files": [
"src/Viserio/helpers.php"
],
"psr-4": {
"Viserio\\" : "src/Viserio/",
"Narrowspark\\" : "benchmarks/"
Expand Down
24 changes: 12 additions & 12 deletions src/Viserio/Support/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ public static function get(string $key, $default = null)
if (in_array(
$value,
[
'false',
'(false)',
'true',
'(true)',
'yes',
'(yes)',
'no',
'(no)',
'on',
'(on)',
'off',
'(off)',
'false',
'(false)',
'true',
'(true)',
'yes',
'(yes)',
'no',
'(no)',
'on',
'(on)',
'off',
'(off)',
]
)) {
$value = str_replace(['(', ')'], '', $value);
Expand Down
19 changes: 19 additions & 0 deletions src/Viserio/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);

use Viserio\Support\Env;

if (! function_exists('env')) {
/**
* Gets the value of an environment variable. Supports boolean, empty and null.
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
function get(string $key, $default = null)
{
return Env::get($key, $default);
}
}

0 comments on commit ad5e5c8

Please sign in to comment.