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

// Set default timezone
if (!ini_get('date.timezone')) {
    ini_set('date.timezone', 'UTC');
}

// Search for composer autoload filepath
$autoloadPathList = [
    __DIR__ . '/../../autoload.php',
    __DIR__ . '/../vendor/autoload.php',
    __DIR__ . '/vendor/autoload.php',
];
foreach ($autoloadPathList as $file) {
    if (file_exists($file)) {
        define('COMPOSER_AUTOLOAD', $file);
        break;
    }
}
unset($file);

// Init composer autoload file
if (defined('COMPOSER_AUTOLOAD')) {
    require COMPOSER_AUTOLOAD;
} else {
    fwrite(STDERR, 'No composer autoload file was found, try composer install/update' . PHP_EOL);
    exit;
}

\SocialAPI\Lib\Component\SocialApiCommand::run();
