當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OutputInterface::renderBlock方法代碼示例

本文整理匯總了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');
     }
 }
開發者ID:Alban-io,項目名稱:TheliaStudio,代碼行數:21,代碼來源:ModuleGenerateLoopCommand.php

示例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");
     }
 }
開發者ID:alex63530,項目名稱:thelia,代碼行數:12,代碼來源:ModuleGenerateCommand.php

示例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;
 }
開發者ID:margery,項目名稱:thelia,代碼行數:33,代碼來源:ModulePositionCommand.php


注:本文中的Symfony\Component\Console\Output\OutputInterface::renderBlock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。