1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-04 20:27:35 +02:00

Flextype Core and Plugins: Doctrine Coding Standard #200 #186

- next round of code improvements
This commit is contained in:
Awilum
2019-08-02 00:17:23 +03:00
parent ff34ade733
commit eae6ca8daf
16 changed files with 222 additions and 180 deletions

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Romanenko Sergey <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,9 +11,20 @@
namespace Flextype;
use Flextype\Component\Session\Session;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Filesystem\Filesystem;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Session\Session;
use RuntimeException;
use Slim\App;
use Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware;
use function array_replace_recursive;
use function date_default_timezone_set;
use function define;
use function error_reporting;
use function function_exists;
use function mb_internal_encoding;
use function mb_language;
use function mb_regex_encoding;
/**
* The version of Flextype
@@ -45,52 +55,53 @@ $default_settings_file_path = PATH['config']['default'] . '/settings.json';
$site_settings_file_path = PATH['config']['site'] . '/settings.json';
// Set settings if Flextype settings and Site settings config files exist
if (Filesystem::has($default_settings_file_path) && Filesystem::has($site_settings_file_path)) {
if (($content = Filesystem::read($default_settings_file_path)) === false) {
throw new \RuntimeException('Load file: ' . $default_settings_file_path . ' - failed!');
} else {
$default_settings = JsonParser::decode($content);
}
if (($content = Filesystem::read($site_settings_file_path)) === false) {
throw new \RuntimeException('Load file: ' . $site_settings_file_path . ' - failed!');
} else {
$site_settings = JsonParser::decode($content);
}
// Merge settings
$settings = array_replace_recursive($default_settings, $site_settings);
// Set settings
$registry->set('settings', $settings);
} else {
throw new \RuntimeException("Flextype settings and Site settings config files does not exist.");
if (! Filesystem::has($default_settings_file_path) || ! Filesystem::has($site_settings_file_path)) {
throw new RuntimeException('Flextype settings and Site settings config files does not exist.');
}
if (($content = Filesystem::read($default_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $default_settings_file_path . ' - failed!');
} else {
$default_settings = JsonParser::decode($content);
}
if (($content = Filesystem::read($site_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $site_settings_file_path . ' - failed!');
} else {
$site_settings = JsonParser::decode($content);
}
// Merge settings
$settings = array_replace_recursive($default_settings, $site_settings);
// Set settings
$registry->set('settings', $settings);
/**
* Create new application
*/
$app = new \Slim\App(['settings' => [
'debug' => $registry->get('settings.errors.display'),
'whoops.editor' => $registry->get('settings.whoops.editor'),
'whoops.page_title' => $registry->get('settings.whoops.page_title'),
'displayErrorDetails' => $registry->get('settings.display_error_details'),
'addContentLengthHeader' => $registry->get('settings.add_content_length_header'),
'routerCacheFile' => $registry->get('settings.router_cache_file'),
'determineRouteBeforeAppMiddleware' => $registry->get('settings.determine_route_before_app_middleware'),
'outputBuffering' => $registry->get('settings.output_buffering'),
'responseChunkSize' => $registry->get('settings.response_chunk_size'),
'httpVersion' => $registry->get('settings.http_version'),
'twig' => [
'debug' => $registry->get('settings.errors.display'),
'cache' => PATH['cache'] . '/twig',
'auto_reload' => $registry->get('settings.twig.auto_reload'),
],
'images' => [
'driver' => $registry->get('settings.image.driver'),
]
]
]);
$app = new App([
'settings' => [
'debug' => $registry->get('settings.errors.display'),
'whoops.editor' => $registry->get('settings.whoops.editor'),
'whoops.page_title' => $registry->get('settings.whoops.page_title'),
'displayErrorDetails' => $registry->get('settings.display_error_details'),
'addContentLengthHeader' => $registry->get('settings.add_content_length_header'),
'routerCacheFile' => $registry->get('settings.router_cache_file'),
'determineRouteBeforeAppMiddleware' => $registry->get('settings.determine_route_before_app_middleware'),
'outputBuffering' => $registry->get('settings.output_buffering'),
'responseChunkSize' => $registry->get('settings.response_chunk_size'),
'httpVersion' => $registry->get('settings.http_version'),
'twig' => [
'debug' => $registry->get('settings.errors.display'),
'cache' => PATH['cache'] . '/twig',
'auto_reload' => $registry->get('settings.twig.auto_reload'),
],
'images' => [
'driver' => $registry->get('settings.image.driver'),
],
],
]);
/**
* Set Flextype Dependency Injection Container
@@ -128,8 +139,7 @@ if ($flextype['registry']->get('settings.errors.display')) {
/**
* Add WhoopsMiddleware
*/
$app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware($app));
$app->add(new WhoopsMiddleware($app));
} else {
error_reporting(0);
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Romanenko Sergey <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,9 +11,8 @@
namespace Flextype;
use Psr7Middlewares\Middleware;
use Psr7Middlewares\Middleware\TrailingSlash;
use Psr7Middlewares\Middleware\ResponseTime;
use Psr7Middlewares\Middleware\TrailingSlash;
/**
* Add middleware CSRF (cross-site request forgery) protection for all routes
@@ -26,4 +24,7 @@ $app->add($flextype->get('csrf'));
*/
$app->add((new TrailingSlash(false))->redirect(301));
/**
* Add middleware ResponseTime for all routes
*/
$app->add((new ResponseTime()));

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,9 +11,15 @@
namespace Flextype;
use RuntimeException;
use const JSON_PRETTY_PRINT;
use const JSON_UNESCAPED_SLASHES;
use const JSON_UNESCAPED_UNICODE;
use function json_decode;
use function json_encode;
class JsonParser
{
/**
* Encode options
*
@@ -67,22 +72,22 @@ class JsonParser
*
* $result = JsonParser::encode($json_content);
*
* @param mixed $input A string containing JSON
* @param int $encode_depth User specified recursion depth.
* @param int $encode_options Bitmask consisting of encode options.
* @return mixed The JSON converted to a PHP value
* @param mixed $input A string containing JSON
* @param int $encode_depth User specified recursion depth.
* @param int $encode_options Bitmask consisting of encode options.
*
* @return mixed The JSON converted to a PHP value
*/
public static function encode($input, int $encode_options = 0, int $encode_depth = 512) : string
{
$encoded = @json_encode(
$input,
$encode_options ? $encode_options : JsonParser::$encode_options,
$encode_depth ? $encode_depth : JsonParser::$encode_depth
);
$encode_options ? $encode_options : self::$encode_options,
$encode_depth ? $encode_depth : self::$encode_depth
);
if ($encoded === false) {
throw new \RuntimeException('Encoding JSON failed');
throw new RuntimeException('Encoding JSON failed');
}
return $encoded;
@@ -93,10 +98,11 @@ class JsonParser
*
* $array = JsonParser::decode($json_file_content);
*
* @param string $input A string containing JSON
* @param bool $decode_assoc When TRUE, returned objects will be converted into associative arrays.
* @param int $decode_depth User specified recursion depth.
* @param int $decode_options Bitmask consisting of decode options.
* @param string $input A string containing JSON
* @param bool $decode_assoc When TRUE, returned objects will be converted into associative arrays.
* @param int $decode_depth User specified recursion depth.
* @param int $decode_options Bitmask consisting of decode options.
*
* @return mixed The JSON converted to a PHP value
*
* @throws ParseException If the JSON is not valid
@@ -105,13 +111,13 @@ class JsonParser
{
$decoded = @json_decode(
$input,
$decode_assoc ? $decode_assoc : JsonParser::$decode_assoc,
$decode_depth ? $decode_depth : JsonParser::$decode_depth,
$decode_options ? $decode_options : JsonParser::$decode_options
);
$decode_assoc ? $decode_assoc : self::$decode_assoc,
$decode_depth ? $decode_depth : self::$decode_depth,
$decode_options ? $decode_options : self::$decode_options
);
if ($decoded === false) {
throw new \RuntimeException('Decoding JSON failed');
throw new RuntimeException('Decoding JSON failed');
}
return $decoded;

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Romanenko Sergey <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -18,6 +17,6 @@ use Psr\Http\Message\ServerRequestInterface as Request;
/**
* Generates and returns the image response
*/
$app->get('/image/{path:.+}', function (Request $request, Response $response, array $args) use ($flextype) {
$app->get('/image/{path:.+}', static function (Request $request, Response $response, array $args) use ($flextype) {
return $flextype['images']->getImageResponse($args['path'], $_GET);
});

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -13,8 +12,10 @@
namespace Flextype;
use Flextype\Component\Assets\Assets;
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
class AssetsTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
class AssetsTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
/**
* Register Global variables in an extension
@@ -22,7 +23,7 @@ class AssetsTwigExtension extends \Twig_Extension implements \Twig_Extension_Glo
public function getGlobals()
{
return [
'assets' => new AssetsTwig()
'assets' => new AssetsTwig(),
];
}
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,18 +11,20 @@
namespace Flextype;
class CsrfTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
{
use Slim\Csrf\Guard;
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig_SimpleFunction;
/**
* @var \Slim\Csrf\Guard
*/
class CsrfTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
/** @var Guard */
protected $csrf;
/**
* Constructor
*/
public function __construct(\Slim\Csrf\Guard $csrf)
public function __construct(Guard $csrf)
{
$this->csrf = $csrf;
}
@@ -34,20 +35,20 @@ class CsrfTwigExtension extends \Twig_Extension implements \Twig_Extension_Globa
public function getGlobals()
{
// CSRF token name and value
$csrfNameKey = $this->csrf->getTokenNameKey();
$csrfNameKey = $this->csrf->getTokenNameKey();
$csrfValueKey = $this->csrf->getTokenValueKey();
$csrfName = $this->csrf->getTokenName();
$csrfValue = $this->csrf->getTokenValue();
$csrfName = $this->csrf->getTokenName();
$csrfValue = $this->csrf->getTokenValue();
return [
'csrf' => [
'keys' => [
'name' => $csrfNameKey,
'value' => $csrfValueKey
'value' => $csrfValueKey,
],
'name' => $csrfName,
'value' => $csrfValue
]
'value' => $csrfValue,
],
];
}
@@ -61,21 +62,19 @@ class CsrfTwigExtension extends \Twig_Extension implements \Twig_Extension_Globa
*
* @return array
*/
public function getFunctions()
public function getFunctions() : array
{
return [
new \Twig_SimpleFunction('csrf', [$this, 'csrf'], ['is_safe' => ['html']]),
new Twig_SimpleFunction('csrf', [$this, 'csrf'], ['is_safe' => ['html']]),
];
}
/**
* CSRF
*
* @return string
*/
public function csrf()
public function csrf() : string
{
return '<input type="hidden" name="'.$this->csrf->getTokenNameKey().'" value="'.$this->csrf->getTokenName().'">'.
'<input type="hidden" name="'.$this->csrf->getTokenValueKey().'" value="'.$this->csrf->getTokenValue().'">';
return '<input type="hidden" name="' . $this->csrf->getTokenNameKey() . '" value="' . $this->csrf->getTokenName() . '">' .
'<input type="hidden" name="' . $this->csrf->getTokenValueKey() . '" value="' . $this->csrf->getTokenValue() . '">';
}
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,7 +11,10 @@
namespace Flextype;
class EmitterTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
class EmitterTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
/**
* Flextype Dependency Container
@@ -33,7 +35,7 @@ class EmitterTwigExtension extends \Twig_Extension implements \Twig_Extension_Gl
public function getGlobals()
{
return [
'emmiter' => new EmitterTwig($this->flextype)
'emmiter' => new EmitterTwig($this->flextype),
];
}
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,7 +11,10 @@
namespace Flextype;
class EntriesTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
class EntriesTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
/**
* Flextype Dependency Container
@@ -33,7 +35,7 @@ class EntriesTwigExtension extends \Twig_Extension implements \Twig_Extension_Gl
public function getGlobals()
{
return [
'entries' => new EntriesTwig($this->flextype)
'entries' => new EntriesTwig($this->flextype),
];
}
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -13,22 +12,27 @@
namespace Flextype;
use Flextype\Component\Filesystem\Filesystem;
use Twig_Extension;
use Twig_SimpleFunction;
use function basename;
use function strrchr;
use function substr;
class FilesystemTwigExtension extends \Twig_Extension
class FilesystemTwigExtension extends Twig_Extension
{
/**
* Callback for twig.
*
* @return array
*/
public function getFunctions()
public function getFunctions() : array
{
return [
new \Twig_SimpleFunction('filesystem_list_contents', [$this, 'list_contents']),
new \Twig_SimpleFunction('filesystem_has', [$this, 'has']),
new \Twig_SimpleFunction('filesystem_read', [$this, 'read']),
new \Twig_SimpleFunction('filesystem_ext', [$this, 'ext']),
new \Twig_SimpleFunction('filesystem_basename', [$this, 'basename']),
new Twig_SimpleFunction('filesystem_list_contents', [$this, 'list_contents']),
new Twig_SimpleFunction('filesystem_has', [$this, 'has']),
new Twig_SimpleFunction('filesystem_read', [$this, 'read']),
new Twig_SimpleFunction('filesystem_ext', [$this, 'ext']),
new Twig_SimpleFunction('filesystem_basename', [$this, 'basename']),
];
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,9 +11,10 @@
namespace Flextype;
use Slim\Flash\Messages;
use Twig_Extension;
use Twig_SimpleFunction;
class FlashTwigExtension extends \Twig_Extension
class FlashTwigExtension extends Twig_Extension
{
/**
* Flextype Dependency Container
@@ -37,7 +37,7 @@ class FlashTwigExtension extends \Twig_Extension
public function getFunctions() : array
{
return [
new \Twig_SimpleFunction('flash', [$this, 'getMessages']),
new Twig_SimpleFunction('flash', [$this, 'getMessages']),
];
}
@@ -45,12 +45,11 @@ class FlashTwigExtension extends \Twig_Extension
* Returns Flash messages; If key is provided then returns messages
* for that key.
*
* @param string $key
* @return array
*/
public function getMessages($key = null) : array
public function getMessages(?string $key = null) : array
{
if (null !== $key) {
if ($key !== null) {
return $this->flextype['flash']->getMessage($key);
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,7 +11,11 @@
namespace Flextype;
class GlobalVarsTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use const PHP_VERSION;
class GlobalVarsTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
/**
* Flextype Dependency Container
@@ -44,7 +47,7 @@ class GlobalVarsTwigExtension extends \Twig_Extension implements \Twig_Extension
'PATH_CACHE' => PATH['cache'],
'FLEXTYPE_VERSION' => FLEXTYPE_VERSION,
'PHP_VERSION' => PHP_VERSION,
'registry' => $this->flextype['registry']->dump()
'registry' => $this->flextype['registry']->dump(),
];
}
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -13,25 +12,27 @@
namespace Flextype;
use Flextype\Component\I18n\I18n;
use Twig_Extension;
use Twig_SimpleFunction;
class I18nTwigExtension extends \Twig_Extension
class I18nTwigExtension extends Twig_Extension
{
/**
* Returns a list of functions to add to the existing list.
*
* @return array
*/
public function getFunctions()
public function getFunctions() : array
{
return [
new \Twig_SimpleFunction('tr', [$this, 'tr']),
new Twig_SimpleFunction('tr', [$this, 'tr']),
];
}
/**
* Translate string
*/
public function tr(string $translate, string $locale = null, array $values = []) : string
public function tr(string $translate, ?string $locale = null, array $values = []) : string
{
return I18n::find($translate, $locale, $values);
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,18 +11,21 @@
namespace Flextype;
class JsonParserTwigExtension extends \Twig_Extension
use Twig_Extension;
use Twig_SimpleFunction;
class JsonParserTwigExtension extends Twig_Extension
{
/**
* Returns a list of functions to add to the existing list.
*
* @return array
*/
public function getFunctions()
public function getFunctions() : array
{
return [
new \Twig_SimpleFunction('json_parser_decode', [$this, 'decode']),
new \Twig_SimpleFunction('json_parser_encode', [$this, 'encode'])
new Twig_SimpleFunction('json_parser_decode', [$this, 'decode']),
new Twig_SimpleFunction('json_parser_encode', [$this, 'encode']),
];
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,9 +11,11 @@
namespace Flextype;
class ShortcodesTwigExtension extends \Twig_Extension
{
use Twig_Extension;
use Twig_SimpleFilter;
class ShortcodesTwigExtension extends Twig_Extension
{
/**
* Flextype Dependency Container
*/
@@ -33,10 +34,10 @@ class ShortcodesTwigExtension extends \Twig_Extension
*
* @return array
*/
public function getFilters()
public function getFilters() : array
{
return [
new \Twig_SimpleFilter('shortcode', [$this, 'shortcode']),
new Twig_SimpleFilter('shortcode', [$this, 'shortcode']),
];
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,7 +11,10 @@
namespace Flextype;
class SnippetsTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
class SnippetsTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
/**
* Flextype Dependency Container
@@ -33,7 +35,7 @@ class SnippetsTwigExtension extends \Twig_Extension implements \Twig_Extension_G
public function getGlobals()
{
return [
'snippets' => new SnippetsTwig($this->flextype)
'snippets' => new SnippetsTwig($this->flextype),
];
}
}

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types=1);
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
@@ -12,6 +11,15 @@
namespace Flextype;
use const DIRECTORY_SEPARATOR;
use const PHP_VERSION;
use function define;
use function getcwd;
use function is_file;
use function sprintf;
use function str_replace;
use function version_compare;
/**
* Define the application minimum supported PHP version.
*/
@@ -25,17 +33,19 @@ define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
/**
* Define the PATH (without trailing slash).
*/
define('PATH', ['site' => ROOT_DIR . '/site',
'plugins' => ROOT_DIR . '/site/plugins',
'themes' => ROOT_DIR . '/site/themes',
'entries' => ROOT_DIR . '/site/entries',
'snippets' => ROOT_DIR . '/site/snippets',
'fieldsets' => ROOT_DIR . '/site/fieldsets',
'config' => [
'default' => ROOT_DIR . '/flextype/config',
'site' => ROOT_DIR . '/site/config'
],
'cache' => ROOT_DIR . '/site/cache']);
define('PATH', [
'site' => ROOT_DIR . '/site',
'plugins' => ROOT_DIR . '/site/plugins',
'themes' => ROOT_DIR . '/site/themes',
'entries' => ROOT_DIR . '/site/entries',
'snippets' => ROOT_DIR . '/site/snippets',
'fieldsets' => ROOT_DIR . '/site/fieldsets',
'config' => [
'default' => ROOT_DIR . '/flextype/config',
'site' => ROOT_DIR . '/site/config',
],
'cache' => ROOT_DIR . '/site/cache',
]);
/**
* Check PHP Version
@@ -45,7 +55,7 @@ version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(s
/**
* Ensure vendor libraries exist
*/
!is_file($autoload = __DIR__ . '/vendor/autoload.php') and exit("Please run: <i>composer install</i>");
! is_file($autoload = __DIR__ . '/vendor/autoload.php') and exit('Please run: <i>composer install</i>');
/**
* Register The Auto Loader