runCommand($argv); echo PHP_EOL; } /** * Get the list of available commands. * * @return array the list of command objects */ private function getCommands(): array { $files = FileSystem::glob(AM_BASE_DIR . '/automad/src/server/Console/Commands/*.php'); foreach ($files as $file) { require_once $file; } $classList = array_filter(get_declared_classes(), function ($cls) { return (strpos($cls, 'Automad\Console\Commands') !== false && strpos($cls, 'Commands\AbstractCommand') === false); }); $commands = array(); foreach ($classList as $cls) { $command = new $cls(); $commands[$command->name()] = (object) array( 'class' => $cls, 'help' => $command->help() ); } return $commands; } /** * Show the help for all available commands. * * @param array $commands */ private function help(array $commands): void { echo PHP_EOL . 'Commands: ' . PHP_EOL; foreach ($commands as $name => $command) { echo ' ' . str_pad($name, 15) . $command->help . PHP_EOL; } } /** * Run a command based on the $argv array. * * @param array $argv */ private function runCommand(array $argv): void { $commands = $this->getCommands(); if (empty($argv[1])) { echo 'Usage:' . PHP_EOL; echo ' php automad/console [command]' . PHP_EOL; $this->help($commands); } else { $name = $argv[1]; if (array_key_exists($name, $commands)) { $cls = $commands[$name]->class; $command = new $cls; $command->run(); } else { echo "The command $name does not exist." . PHP_EOL; $this->help($commands); } } } } __halt_compiler();----SIGNATURE:----1Yxlgl18W/ifiLVg2Lyb63CzHL/Matthuqsmlf3db5yevKjTlkeDeOdxcijx5tvLyY442sKteDLCP8GDfdpOJwVnxvsTKkE7EzXcNxLpZwNyJbh8weKpmdmaiCE1yLHzNWVV78qpWP8M9/kDYk0POUq4EGgebhOQlzHWvdHHi4c5YPppEwTob/6S3bwC7oTvahGrXEIvVhyTE+1VIqB2ZJR42rdXsmPlLKqSyV4aAr2EzeCLXOazQFuZDpSdmwnTMIOxoSVLdAsYMJSIUewCfPCtETKeh5pTEeUEFgoefKwMEXXO6o0XpZOAjL0RdlMwtNuorXtY1yWm7FW0mogeaBzZEGGF9Ypw6lxI6d/d0pnTPhWBOHudHhG5FO7cgt04K+O7/d2PR9RLhLZfppAKPP/IApON+O57dUjZMlXsNAvB6qYllhILBRS2VeaBOeOb1DuyUvaaFFqSRDYfQoanj2QWvlq8mefRp33i97BtYQM7ySnCMFor4UjT4bMytkFug27Al7+7I3kxacQaba+Jar1KcJsSGJJDWg8zQvybTty8sIPmAl6AC1WxGA7LJaJuIo7+8r3R3voUa0LVNDJc7DgRYuvkj9x4BEKDNNKrrapu5G7Fi6wVsPHz3weJMQka/YjBUiA+FjqWTylpZYdAFN6Bz0BuIVEhbnccrrgfhY4=----ATTACHMENT:----NDk2NDM2ODAwNTI4NDk2NCAzNTgwNDg5MjEyODI2MjcxIDk0Nzc2NjM4NDQ4MzMwNDE=