/** * Shows support info for all or specified setting(s) * * @param null|string $key Key/name of a specific setting. Leave empty for * all settings. */ public function showSupportedSettings($key = null) { $settings = array(); if ($key !== null && isset($this->supportedSettings[$key])) { $settings[$key] = $this->supportedSettings[$key]; } else { $settings = $this->supportedSettings; } $currentSettings = Setting::select()->in('key', array_keys($settings))->all(); $out = $this->client->getOutput(); $out->section('Supported settings [default]'); foreach ($settings as $key => $info) { $out->write($key); if (isset($currentSettings[$key])) { $out->write(' = ' . $currentSettings[$key]->value); } if (isset($info['default'])) { $out->write(' [' . $info['default'] . ']'); } $out->newLine(); $out->writeln($info['desc']); $out->newLine(); } }
/** * @param Client $client */ public function __construct($client) { $this->client = $client; $this->out = $this->client->getOutput(); }
<?php use phparsenal\fastforward\Client; require __DIR__ . DIRECTORY_SEPARATOR . 'vendor/autoload.php'; // Replace the path to *this* PHP file with the alias because the usage summary // relies on this. if ($argc > 0) { $argv[0] = 'ff'; } $client = new Client('fast-forward', Client::FF_VERSION); $client->init(); try { $client->run(); } catch (\Exception $e) { $msg = array($e->getMessage(), $e->getTraceAsString()); $client->getOutput()->error($msg); }