hide map for Character groups Quest Stations when there are no stations
This commit is contained in:
commit
df14dfafc3
4371 changed files with 1220224 additions and 0 deletions
68
www/analytics/core/Plugin/ConsoleCommand.php
Normal file
68
www/analytics/core/Plugin/ConsoleCommand.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugin;
|
||||
|
||||
use Piwik\Common;
|
||||
use Symfony\Component\Console\Command\Command as SymfonyCommand;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
||||
/**
|
||||
* The base class for console commands.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
class ConsoleCommand extends SymfonyCommand
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|null $name The name of the command, eg, `'generate:api'`.
|
||||
*/
|
||||
public function __construct($name = null)
|
||||
{
|
||||
if (!Common::isPhpCliMode()) {
|
||||
throw new \RuntimeException('Only executable in CLI mode');
|
||||
}
|
||||
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function writeSuccessMessage(OutputInterface $output, $messages)
|
||||
{
|
||||
$lengths = array_map('strlen', $messages);
|
||||
$maxLen = max($lengths) + 4;
|
||||
|
||||
$separator = str_pad('', $maxLen, '*');
|
||||
|
||||
$output->writeln('');
|
||||
$output->writeln('<info>' . $separator . '</info>');
|
||||
|
||||
foreach ($messages as $message) {
|
||||
$output->writeln(' ' . $message . ' ');
|
||||
}
|
||||
|
||||
$output->writeln('<info>' . $separator . '</info>');
|
||||
$output->writeln('');
|
||||
}
|
||||
|
||||
protected function checkAllRequiredOptionsAreNotEmpty(InputInterface $input)
|
||||
{
|
||||
$options = $this->getDefinition()->getOptions();
|
||||
|
||||
foreach ($options as $option) {
|
||||
$name = $option->getName();
|
||||
$value = $input->getOption($name);
|
||||
|
||||
if ($option->isValueRequired() && empty($value)) {
|
||||
throw new \InvalidArgumentException(sprintf('The required option %s is not set', $name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue