projek-xyz/slim-skeleton

View on GitHub
app/bootstrap.php

Summary

Maintainability
A
0 mins
Test Coverage
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 8 and the first side effect is on line 11.
<?php
 
use Projek\Slim\Container;
 
/**
* @codingStandardsIgnoreLine
*/
define('ROOT_DIR', dirname(__DIR__).DIRECTORY_SEPARATOR);
 
// Loading vendors
require ROOT_DIR.'vendor/autoload.php';
 
if (file_exists(ROOT_DIR.'.env')) {
(new Dotenv\Dotenv(ROOT_DIR))->load();
}
 
$settings = require_once __DIR__.'/settings.php';
 
// Let's just use PHP Native sesion
if (!isset($_SESSION)) {
session_name($settings['basename']);
session_start();
}
 
return new Container(['settings' => $settings], ROOT_DIR);