Print system message.

@param OutputInterface $output
@param string          $header
@param string          $body
514491
protected static function printSystemMessage(
        OutputInterface $output,
        $header,
        $body
    ) {
        self::printStructureMessage(
            $output,
            $header,
            $body,
            'system'
        );
    }
807965
protected function checkPermission(OutputInterface $output)
    {
        $output->writeln(array(
            "Checking some permissions"
        ));

        /** @var Translator $translator */
        $translator = $this->getContainer()->get('thelia.translator');

        $permissions = new CheckPermission(false, $translator);
        $isValid = $permissions->exec();

        foreach ($permissions->getValidationMessages() as $item => $data) {
            if ($data['status']) {
                $output->writeln(
                    array(
                        sprintf(
                            "<info>%s ...</info> %s",
                            $data['text'],
                            "<info>Ok</info>"
                        )
                    )
                );
            } else {
                $output->writeln(array(
                    sprintf(
                        "<error>%s </error>%s",
                        $data['text'],
                        sprintf("<error>%s</error>", $data["hint"])
                    )
                ));
            }
        }

        if (false === $isValid) {
            throw new \RuntimeException('Please put correct permissions and reload install process');
        }
    }
1340384
protected function outputFixMessage(OutputInterface $output)
    {
        $output->writeln('');
        $output->writeln("<error>    Oh dear \xF0\x9F\x98\xA2     </error>");
        $output->writeln('');
        $output->writeln("<info>Sadly, not all checks went well</info>");
        $output->writeln('<info>But this is no reason to give up!</info>');
        $output->writeln('<info>Remember: This check was to verifiy if Gerrie is working to avoid unnecessary problems.</info>');
        $output->writeln("<info>So get up, grab a \xE2\x98\x95  and try to fix the failing checks.</info>");
        $output->writeln('');
        $output->writeln('<info>If you don`t know how to solve this "problem(s)":</info>');
        $output->writeln('<info>  * have a look at the documentation</info>');
        $output->writeln('<info>  * or open an issue on GitHub</info>');
        $output->writeln('');
        $output->writeln('<info>Do not be afraid. You can execute this check whenever you want.</info>');
        $output->writeln('<info>It is for free and breaks nothing :)</info>');
        $output->writeln("<info>So keep \xF0\x9F\x8E\xB8  and cu next time \xF0\x9F\x91\x8B</info>");
        $output->writeln('');
    }
350664
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output, false);
        $domains = $input->getOption('domain');
        $languages = $input->getOption('language');
        $project = $this->createProjectByInput($input);
        $questionHelper = $this->getHelper('question');

        while (true) {
            $randomTranslation = $project->getRandomMissingTranslation(
                $domains,
                $languages
            );

            if (!($randomTranslation instanceof Translation)) {
                $this
                    ->printMessage(
                        $output,
                        'Trans Server',
                        'No more translations for you!'
                    );

                break;
            }

            $this->printMessage(
                $output,
                'Trans Server',
                'Language : ' . $randomTranslation->getLanguage()
            );
            $this->printMessage(
                    $output,
                    'Trans Server',
                    'Key : ' . $randomTranslation->getKey()
                );
            $this->printMessage(
                    $output,
                    'Trans Server',
                    'Original : ' . $randomTranslation
                        ->getMasterTranslation()
                        ->getValue()
                );

            $question = new Question('[Trans Server] Translation : ');
            $translationValue = $questionHelper->ask(
                $input,
                $output,
                $question
            );

            if (false === $translationValue) {
                break;
            }

            $randomTranslation->setValue($translationValue);
            $masterStructure = $randomTranslation->getStructure();
            $this->overwriteLastValueFromStructure(
                $masterStructure,
                $translationValue
            );
            $randomTranslation->setStructure($masterStructure);

            $project->addTranslation($randomTranslation);
            $project->save();
            $output->writeln('');
        }

        $this->finishCommand($output);
    }
1177190
function display_body(body, is_toplevel, output, allow_directives) {
          var last = body.length - 1;
          in_directive = allow_directives;
          body.forEach(function(stmt, i) {
              if (in_directive === true && !(stmt instanceof AST_Directive ||
                  stmt instanceof AST_EmptyStatement ||
                  (stmt instanceof AST_SimpleStatement && stmt.body instanceof AST_String)
              )) {
                  in_directive = false;
              }
              if (!(stmt instanceof AST_EmptyStatement)) {
                  output.indent();
                  stmt.print(output);
                  if (!(i == last && is_toplevel)) {
                      output.newline();
                      if (is_toplevel) output.newline();
                  }
              }
              if (in_directive === true &&
                  stmt instanceof AST_SimpleStatement &&
                  stmt.body instanceof AST_String
              ) {
                  in_directive = false;
              }
          });
          in_directive = false;
      }
1008547
protected function mail($to, $subject, $body, array $headers)
    {
        mail($to, $subject, $body, implode("\r\n", $headers));
    }
1148712
protected function outputFormatTable($data, array $header)
    {
        if (!is_array($data)) {
            $this->line(print_r($data, true));
            $this->output();
        }

        foreach ($data as &$row) {

            if (!is_array($row)) {
                $this->errorAndExit($this->text('Unexpected table row format'));
            }

            ksort($row);

            foreach ($row as &$item) {
                if (is_array($item)) {
                    $item = '-- Array ' . count($item) . ' items --';
                }
            }
        }

        if (empty($data)) {
            $this->line($this->text('No results'));
        } else {
            array_unshift($data, $header);
            $this->table($data);
        }

        $this->output();
    }
403366
public function output(ResponseInterface $response, bool $emulate = false)
    {
        $code = $response->getStatus();
        $headers = $response->getHeaders();
        $body = $response->getContent();

        //make sure it's a string
        $body = (string) $body;

        if ($emulate) {
            $this->successful = true;
            return $body;
        }

        //now map it out
        call_user_func($this->map['output'], $code, $headers, $body);

        $this->successful = true;

        return $this;
    }
636475
protected function writeln(OutputInterface $output = null, $message)
    {
        if ($output instanceof OutputInterface) {
            $output->writeln($message);
        }
    }
1165569
public static function printResult(
        OutputInterface $output,
        Result $result
    ) {
        self::printInfoMessage(
            $output,
            'Number of resources in index',
            $result->getTotalItems()
        );

        self::printInfoMessage(
            $output,
            'Number of hits',
            $result->getTotalHits()
        );

        $output->writeln('');

        foreach ($result->getItems() as $item) {
            $firstStringPosition = array_reduce($item->getAllMetadata(), function ($carry, $element) {
                return is_string($carry)
                    ? $carry
                    : (
                    is_string($element)
                        ? $element
                        : null
                    );
            }, null);

            self::printInfoMessage(
                $output,
                'x',
                sprintf('%s - %s',
                    $item->getUUID()->composeUUID(),
                    substr((string) $firstStringPosition, 0, 50)
                )
            );
        }
    }
1128037
protected function printTable(InputInterface $input, OutputInterface $output, $environment)
    {
        $table   = new Table($output);
        $headers = array('Level', 'Message');

        $table->setHeaders($headers);

        foreach ($environment->getConfig()->ruleSet() as $ruleSet) {
            foreach ($ruleSet->getErrorMessages() as $message) {
                $table->addRow(
                    [
                        $ruleSet->getName(),
                        $message->getMessage(),
                    ]
                );
            }
        }

        $output->writeln('');
        $table->render();
    }
1236600
public function output($response, $context = null)
    {
        $this->builder->output()->response($response, $context);
    }
633583
public function delete(OutputInterface $output, array $response)
    {
        $this->printBoolean($output, 'OK', $response['success'], true === $response['success']);
    }
706147
public function sendHeader($output = null, $replace = true, $http_response_code = null)
    {
        if (!headers_sent()) {
            if(static::$redirectHeader !== null) {
                $this->redirect();
            }
            if($this->version === 'HTTP/1.1') {
                if(count($this->headers) === 0) {
                    header("$this->version $this->header");
                }
            }
            else {
                throw new Exception("Invalid HTTP version ".$this->version.".");
                exit;
            }
            foreach($this->headers as $header) {
                if($http_response_code == null) {
                    header("$header", $replace);
                }
                else {
                    header("$header", $replace, $http_response_code);
                }
            }
            if($output) {
                print $output;
                exit;
            }
        } 
    }
898422
protected function outputBody()
    {
        // Only show error pages or generic "friendly" errors if the status code signifies
        // an error, and the response doesn't have any body yet that might contain
        // a more specific error description.
        $body = $this->getBody();
        if ($this->isError() && empty($body)) {
            /** @var HandlerInterface $handler */
            $handler = Injector::inst()->get(HandlerInterface::class);
            $formatter = $handler->getFormatter();
            echo $formatter->format([
                'code' => $this->statusCode,
            ]);
        } else {
            echo $this->body;
        }
    }
1149909
protected function printApplicationTitle(OutputInterface $output): void
    {
        $output->writeln('');
        $output->writeln('DocBlock Checker');
        $output->writeln('');
    }
196852
private function endOutputBuffer($output = null): void
    {
        // handle redirections
        $statusCode = $this->response->status()->getCode();
        if ($statusCode >= 300 && $statusCode <= 399) {
            // clean & turn off output buffering
            while (ob_get_level()) {
                ob_end_clean();
            }
            $this->response->body()->setContentType('none');
        }
        // handle outputs
        else {
            // echo'd or print'ed service methods return 'null'
            if ($output === null) {
                $output = '';
                while (ob_get_level()) {
                    $output .= ob_get_clean();
                }
            }

            // call user output handler if provided
            if ($this->events->has('app.output')) {
                $output = $this->events->fire('app.output', $output);
            }

            $this->response->setBody($output);
        }

        $this->response->end();
    }