本文整理匯總了PHP中Symfony\Component\Console\Output\OutputInterface::renderBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputInterface::renderBlock方法的具體用法?PHP OutputInterface::renderBlock怎麽用?PHP OutputInterface::renderBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Output\OutputInterface
的用法示例。
在下文中一共展示了OutputInterface::renderBlock方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getContainer();
$container->set("request", new Request());
$container->get("request")->setSession(new Session(new MockArraySessionStorage()));
$container->enterScope("request");
try {
$container->get("event_dispatcher")->dispatch(TheliaStudioEvents::LAUNCH_MODULE_BUILD, new ModuleGenerateEvent($input->getArgument("moduleCode"), $input->getOption("tables"), ['php'], ["Loop"]));
$output->renderBlock(array('', 'Everything has been generated successfully', 'Files available in your module directory', ''), 'bg=green;fg=black');
} catch (\Exception $e) {
$outputArray = explode("\n", $e->getMessage());
array_push($outputArray, '');
array_unshift($outputArray, '');
$output->renderBlock($outputArray, 'bg=red;fg=white');
}
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->module = $this->formatModuleName($input->getArgument("name"));
$this->moduleDirectory = THELIA_MODULE_DIR . DIRECTORY_SEPARATOR . $this->module;
$this->verifyExistingModule();
$this->createDirectories();
$this->createFiles();
if (method_exists($this, "renderBlock")) {
//impossible to change output class in CommandTester...
$output->renderBlock(array('', sprintf("module %s create with success", $this->module), "You can now configure your module and complete module.xml file", ''), "bg=green;fg=black");
}
}
示例3: checkPositions
/**
* Check positions consistency
*
* @param OutputInterface $output An OutputInterface instance
* @param bool $isAbsolute Set to true or false according to position values
*
* @throws \InvalidArgumentException
*
* @return bool Continue or stop command
*/
protected function checkPositions(OutputInterface $output, &$isAbsolute = false)
{
$isRelative = false;
foreach (array_count_values($this->positionsList) as $value => $count) {
if (is_int($value) && $value[0] !== '+' && $value[0] !== '-') {
$isAbsolute = true;
if ($count > 1) {
throw new \InvalidArgumentException('Two (or more) absolute positions are identical.');
}
} else {
$isRelative = true;
}
}
if ($isAbsolute && $isRelative) {
$output->renderBlock(['', 'Mix absolute and relative positions may produce unexpected results !', ''], 'bg=yellow;fg=black');
/** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */
$dialog = $this->getHelper('dialog');
if (!$dialog->askConfirmation($output, '<question>Do you want to continue ? y/[n]<question>', false)) {
return false;
}
}
return true;
}