public function execute(InputInterface $input, OutputInterface $output) { $filename = getcwd() . '/blazon.yml'; if ($input->getOption('filename')) { $filename = $input->getOption('filename'); } $dest = null; if ($input->getOption('dest')) { $dest = $input->getOption('dest'); $dest = Utils::makePathAbsolute($dest); } $blazon = new Blazon($filename, $output, $dest); $blazon->init(); $output->writeLn("<comment>Done</comment>"); }
<?php use Blazon\Blazon; $loader = __DIR__ . '/../vendor/autoload.php'; if (!file_exists($loader)) { $loader = __DIR__ . '/../../../autoload.php'; } if (!file_exists($loader)) { 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' . PHP_EOL); } $autoLoader = (require $loader); $filename = getenv('BLAZON_FILE'); if (!$filename) { throw new RuntimeException("Environment variable BLAZON_FILE not set (correctly)"); } $blazon = new Blazon($filename, null, null); $blazon->run(); //print_r($_SERVER); $uri = $_SERVER['REQUEST_URI']; if ($uri == '/') { $uri = '/index'; } $filename = $blazon->getDest() . $uri; if (!file_exists($filename)) { $filename .= '.html'; if (!file_exists($filename)) { http_response_code(404); echo "<h1>404 File not found</h1><h2>" . $uri . '</h2>'; exit; } }