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

/*
 * GraPHPizer - Store PHP syntax trees in a Neo4j database
 * Copyright (C) 2015  Martin Helmich <kontakt@martin-helmich.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

use Helmich\Graphizer\Console\Application;
use Helmich\Graphizer\Console\Command\CommandBuilder;
use Helmich\Graphizer\Console\Command\Export\ExportCodeCommand;
use Helmich\Graphizer\Console\Command\Export\ExportD3jsCommand;
use Helmich\Graphizer\Console\Command\Export\ExportDotCommand;
use Helmich\Graphizer\Console\Command\Export\ExportGexfCommand;
use Helmich\Graphizer\Console\Command\Export\ExportJsonCommand;
use Helmich\Graphizer\Console\Command\Export\ExportPlantUmlCommand;
use Helmich\Graphizer\Console\Command\GenerateMetricCommand;
use Helmich\Graphizer\Console\Command\GenerateModelCommand;
use Helmich\Graphizer\Console\Command\ImportCommand;
use Helmich\Graphizer\Console\Command\PruneCommand;

if (file_exists(__DIR__ . '/vendor/autoload.php'))
{
	require_once __DIR__ . '/vendor/autoload.php';
}
else if (file_exists(__DIR__ . '/../../autoload.php'))
{
	require_once __DIR__ . '/../../autoload.php';
}
else
{
	die('Could not find an autoload.php. Did you set up all dependencies?');
}

$commandBuilder = new CommandBuilder();

$app = new Application('GraPHPizer', 'master');
$app->add($commandBuilder->build(ImportCommand::class));
$app->add($commandBuilder->build(PruneCommand::class));
$app->add($commandBuilder->build(GenerateModelCommand::class));
$app->run();
