-
-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathbootstrap.php
32 lines (24 loc) · 929 Bytes
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* This file is part of the bitrix24-php-sdk package.
*
* © Maksim Mesilov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/
declare(strict_types=1);
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
require_once dirname(__DIR__) . '/vendor/autoload.php';
if (!class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
(new Dotenv())->loadEnv(dirname(__DIR__) . '/tests/.env');