* @license MIT */ declare(strict_types=1); require 'app-config.php'; if (php_sapi_name() != 'cli') { http_response_code(404); die('Not Found'); } /** * Print a line with a newline character at the end (printf + newline = printfn; surprised this isn't built in!) * * @param string $format The format string * @param mixed ...$values The values for the placeholders in the string */ function printfn(string $format, mixed ...$values): void { printf($format . PHP_EOL, ...$values); } /** * Display a title for a CLI run * * @param string $title The title to display on the command line */ function cli_title(string $title): void { $appTitle = 'Feed Reader Central ~ ' . display_version(); $dashes = ' +' . str_repeat('-', strlen($title) + 2) . '+' . str_repeat('-', strlen($appTitle) + 2) . '+'; printfn($dashes); printfn(' | %s | %s |', $title, $appTitle); printfn($dashes . PHP_EOL); }