for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
use Dotenv\Environment\Adapter\EnvConstAdapter;
use Dotenv\Environment\Adapter\PutenvAdapter;
use Dotenv\Environment\Adapter\ServerConstAdapter;
use Dotenv\Environment\DotenvFactory;
use Illuminate\Container\Container;
use PhpOption\Option;
if (! function_exists('value')) {
function value($value)
{
return $value instanceof Closure ? $value() : $value;
}
if (! function_exists('env')) {
function env($key, $default = null)
static $variables;
if ($variables === null) {
$variables = (new DotenvFactory([new EnvConstAdapter, new PutenvAdapter, new ServerConstAdapter]))->createImmutable();
return Option::fromValue($variables->get($key))
->map(function ($value) {
switch (strtolower($value)) {
case 'true':
case '(true)':
return true;
case 'false':
case '(false)':
return false;
case 'empty':
case '(empty)':
return '';
case 'null':
case '(null)':
return;
if (preg_match('/\A([\'"])(.*)\1\z/', $value, $matches)) {
return $matches[2];
return $value;
})
->getOrCall(function () use ($default) {
return value($default);
});
if (! function_exists('app')) {
function app($abstract = null, array $parameters = [])
if (is_null($abstract)) {
return Container::getInstance();
return Container::getInstance()->make($abstract, $parameters);