#!/usr/bin/env php
<?php

set_time_limit(0);

function includeIfExists($file) {
    if (file_exists($file)) {
        return require_once $file;
    }
}

if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
    die(
        'You must set up the project dependencies, run the following commands:'.PHP_EOL.
        'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
        'php composer.phar install'
    );
}

use Symfony\Component\Console\Application;
use FLT\Swoole\Command\ServerCommand;

$application = new Application('FLT Swoole Engine', 'v1.0.0');
$serverCommand = new ServerCommand();

$application->add($serverCommand);

$application->setDefaultCommand($serverCommand->getName(), true);
$application->run();
