#!/usr/bin/env php
<?php
$autoloadFiles = [
'loader' => [
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
],
'helpers' => [
__DIR__ . '/../src/helpers.php',
__DIR__ . '/../rest-control/rest-control/src/helpers.php',
],
];
$loadedFiles = null;
foreach($autoloadFiles as $autoloadFileName => $autoloadFileDirs) {
foreach($autoloadFileDirs as $dir) {
if(file_exists($dir)) {
$loadedFiles[$autoloadFileName] = require_once $dir;
}
}
}
if(empty($loadedFiles['loader'])) {
throw new \Exception('Cannot find autoload.php. Please install dependencies via composer.');
}
try{
$console = new \RestControl\Console\Console($loadedFiles['loader']);
exit($console->run());
} catch (\Exception $e) {
echo $e->getMessage() . "\n";
exit(1);
}
|