Render the details of each failed request including the mismatching headers and body.

@param ResultsRenderer $renderer
@return string
552498
public function render(ResultsRenderer $renderer)
    {
        $results = array_filter($this->result->getResults(), function (ResultInterface $result) {
            return $result instanceof FailureInterface;
        });

        $output = '';
        if (count($results)) {
            $output .= $renderer->center("Some executions of your solution produced incorrect output!\n");
        }

        /** @var FailureInterface $request **/
        foreach ($results as $key => $request) {
            $output .= $renderer->lineBreak();
            $output .= "\n";
            $output .= $renderer->style(sprintf('Execution %d', $key + 1), ['bold', 'underline', 'blue']);
            $output .= ' ' . $renderer->style(' FAILED ', ['bg_red', 'bold']) . "\n\n";

            $output .= $request->getArgs()->isEmpty()
                ? "Arguments: None\n"
                : sprintf("Arguments: \"%s\"\n", $request->getArgs()->implode('", "'));

            $output .= "\n" . $renderer->renderResult($request) . "\n";
        }

        return $output;
    }
17630
public function render(Render $renderer)
	{
		$legend = '';

		//Make sure the legend is added if needed
		if ( !is_null($this->getLegend()) )
		{
			$legend = Html::tag('legend', [], $this->getLegend());
		}

		//Makes sure the legend is added if one exists
		$elements = $legend;

		//Render all the elements
		foreach ( $this->getContents() as $element )
		{
			$elements .= "\n" . $renderer->render($element);
		}

		return Html::tag('fieldset', $this->getAttributes(), $elements);
	}
925908
static function render(\Throwable $exception, bool $renderTrace = true, bool $renderPrevious = false): string
    {
        $exceptions = $renderPrevious ? static::getChain($exception) : [$exception];
        $totalExceptions = count($exceptions);
        $lastException = $totalExceptions - 1;

        $output = '';
        for ($i = 0; $i < $totalExceptions; ++$i) {
            if ($i > 0 && $renderTrace) {
                $output .= "\n";
            }

            $output .= ($renderPrevious ? '[' . ($i + 1) . "/{$totalExceptions}] " : '')
                . static::getName($exceptions[$i])
                . ': ' . ($exceptions[$i]->getMessage() ?: '<no message>')
                . " in {$exceptions[$i]->getFile()} on line {$exceptions[$i]->getLine()}";

            if ($renderTrace || $i < $lastException) {
                $output .= "\n";
            }

            if ($renderTrace) {
                $output .= $exceptions[$i]->getTraceAsString();

                if ($i < $lastException) {
                    $output .= "\n";
                }
            }
        }

        return $output;
    }
1245421
public function render($renderer)
    {
        if ($this->x1 === ReportBaseElement::CURRENT_POSITION) {
            $this->x1 = $renderer->getX();
        }
        if ($this->y1 === ReportBaseElement::CURRENT_POSITION) {
            $this->y1 = $renderer->getY();
        }
        if ($this->x2 === ReportBaseElement::CURRENT_POSITION) {
            $this->x2 = $renderer->getRemainingWidth();
        }
        if ($this->y2 === ReportBaseElement::CURRENT_POSITION) {
            $this->y2 = $renderer->getY();
        }
        // Vertical line
        if ($this->x1 == $this->x2) {
            echo '<div style="position:absolute;overflow:hidden;border-', $renderer->alignRTL, ':solid black 1pt;', $renderer->alignRTL, ':', $this->x1, 'pt;top:', $this->y1 + 1, 'pt;width:1pt;height:', $this->y2 - $this->y1, "pt;\"> </div>\n";
        }
        // Horizontal line
        if ($this->y1 == $this->y2) {
            echo '<div style="position:absolute;overflow:hidden;border-top:solid black 1pt;', $renderer->alignRTL, ':', $this->x1, 'pt;top:', $this->y1 + 1, 'pt;width:', $this->x2 - $this->x1, "pt;height:1pt;\"> </div>\n";
        }
        // Keep max Y updated
        // One or the other will be higher... lasy mans way...
        $renderer->addMaxY($this->y1);
        $renderer->addMaxY($this->y2);
    }
311186
public function render($renderer)
    {
        static $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;

        // Get the current positions
        if ($this->x === ReportBaseElement::CURRENT_POSITION) {
            $this->x = $renderer->getX();
        }
        if ($this->y === ReportBaseElement::CURRENT_POSITION) {
            //-- first check for a collision with the last picture
            if (isset($lastpicbottom)) {
                if (($renderer->pageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->getY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)) {
                    $renderer->setY($lastpicbottom + ($renderer->cPadding * 2));
                }
            }
            $this->y = $renderer->getY();
        }

        // Image alignment
        switch ($this->align) {
            case 'L':
                echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
                echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
                break;
            case 'C':
                echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
                echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
                break;
            case 'R':
                echo '<div style="position:absolute;top:', $this->y, 'pt;left:0pt;width:', $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
                echo '<img src="', $this->file, '" style="width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n</div>\n";
                break;
            default:
                echo '<img src="', $this->file, '" style="position:absolute;', $renderer->alignRTL, ':', $this->x, 'pt;top:', $this->y, 'pt;width:', $this->width, 'pt;height:', $this->height, "pt;\" alt=\"\">\n";
        }

        $lastpicpage   = $renderer->pageNo();
        $lastpicleft   = $this->x;
        $lastpicright  = $this->x + $this->width;
        $lastpicbottom = $this->y + $this->height;
        // Setup for the next line
        if ($this->line === 'N') {
            $renderer->setY($lastpicbottom);
        }
        // Keep max Y updated
        $renderer->addMaxY($lastpicbottom);
    }
795927
public function renderResponse(Pagerfanta $pager, AttributeInterface $attribute = null)
    {
        $results = [];
        try {
            /** @noinspection PhpParamsInspection */
            $this->dataLoader->load($pager, 2); // Try to load results if array of EAV data
        } catch (\InvalidArgumentException $e) {
            // Do nothing, it just means that we have an array of scalar
        }
        foreach ($pager as $data) {
            if ($data instanceof DataInterface) {
                $results[] = $this->parseResult($data, $attribute);
            } else {
                $results[] = $this->parseScalarResult($data);
            }
        }

        $headers = [
            'Cache-Control' => 'private, no-cache, no-store, must-revalidate',
            'Pragma' => 'private',
            'Expires' => 0,
        ];

        $response = [
            'results' => $results,
            'pagination' => [
                'more' => $pager->hasNextPage(),
            ],
        ];

        return new JsonResponse($response, 200, $headers);
    }
1229229
public function render(Render $renderer)
	{
		$elements = '';

		foreach ( $this->getContents() as $element )
		{
			$elements .= "\n" . $renderer->render($element);
		}

		return Html::tag('form', $this->getAttributes(), $elements);
	}
35769
public function display(core_backup_renderer $renderer) {

        // Get the resulting stored_file record.
        $type = $this->get_ui()->get_controller()->get_type();
        $courseid = $this->get_ui()->get_controller()->get_courseid();
        switch ($type) {
            case 'activity':
                $cmid = $this->get_ui()->get_controller()->get_id();
                $cm = get_coursemodule_from_id(null, $cmid, $courseid);
                $modcontext = context_module::instance($cm->id);
                $restorerul = new moodle_url('/backup/restorefile.php', array('contextid' => $modcontext->id));
                break;
            case 'course':
            default:
                $coursecontext = context_course::instance($courseid);
                $restorerul = new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id));
        }

        $output = '';
        $output .= $renderer->box_start();
        if (!empty($this->results['include_file_references_to_external_content'])) {
            $output .= $renderer->notification(get_string('filereferencesincluded', 'backup'), 'notifyproblem');
        }
        if (!empty($this->results['missing_files_in_pool'])) {
            $output .= $renderer->notification(get_string('missingfilesinpool', 'backup'), 'notifyproblem');
        }
        $output .= $renderer->notification(get_string('executionsuccess', 'backup'), 'notifysuccess');
        $output .= $renderer->continue_button($restorerul);
        $output .= $renderer->box_end();

        return $output;
    }
827346
public function display(core_backup_renderer $renderer) {
        global $PAGE;

        $html = '';
        $haserrors = false;
        $url = new moodle_url($PAGE->url, array(
            'restore'   => $this->get_uniqueid(),
            'stage'     => restore_ui::STAGE_PROCESS,
            'substage'  => $this->substage,
            'sesskey'   => sesskey()));
        $html .= html_writer::start_tag('form', array(
            'action'    => $url->out_omit_querystring(),
            'class'     => 'backup-restore',
            'enctype'   => 'application/x-www-form-urlencoded', // Enforce compatibility with our max_input_vars hack.
            'method'    => 'post'));
        foreach ($url->params() as $name => $value) {
            $html .= html_writer::empty_tag('input', array(
                'type'  => 'hidden',
                'name'  => $name,
                'value' => $value));
        }
        switch ($this->substage) {
            case self::SUBSTAGE_PRECHECKS :
                $results = $this->ui->get_controller()->get_precheck_results();
                $info = $this->ui->get_controller()->get_info();
                $haserrors = (!empty($results['errors']));
                $html .= $renderer->precheck_notices($results);
                if (!empty($info->role_mappings->mappings)) {
                    $context = context_course::instance($this->ui->get_controller()->get_courseid());
                    $assignableroles = get_assignable_roles($context, ROLENAME_ALIAS, false);

                    // Get current role mappings.
                    $currentroles = role_fix_names(get_all_roles(), $context);
                    // Get backup role mappings.
                    $rolemappings = $info->role_mappings->mappings;

                    array_map(function($rolemapping) use ($currentroles) {
                        foreach ($currentroles as $role) {
                            // Find matching archetype to determine the backup's shortname for label display.
                            if ($rolemapping->archetype == $role->archetype) {
                                $rolemapping->name = $rolemapping->shortname;
                                break;
                            }
                        }
                        if ($rolemapping->name == null) {
                            $rolemapping->name = get_string('undefinedrolemapping', 'backup', $rolemapping->archetype);
                        }
                    }, $rolemappings);

                    $html .= $renderer->role_mappings($rolemappings, $assignableroles);
                }
                break;
            default:
                throw new restore_ui_exception('backup_ui_must_execute_first');
        }
        $html .= $renderer->substage_buttons($haserrors);
        $html .= html_writer::end_tag('form');

        return $html;
    }
670130
public function RenderErrors () {
		/** @var $this \MvcCore\Ext\Forms\IField */
		$result = "";
		if (
			$this->errors && 
			$this->form->GetErrorsRenderMode() !== \MvcCore\Ext\Forms\IForm::ERROR_RENDER_MODE_ALL_TOGETHER
		) {
			$result .= '<span class="errors">';
			foreach ($this->errors as $key => $errorMessage) {
				$errorCssClass = 'error error-' . $this->name . ' error-' . $key;
				$result .= "<span class=\"$errorCssClass\">$errorMessage</span>";
			}
			$result .= '</span>';
		}
		return $result;
	}
1305798
public function render(array $arguments = [], $renderer = null) {
        $this->runDynamicCallbacks($arguments);

        return $this->baseRender($arguments, $renderer);
    }
435515
public function render($renderer=null)
	{
		if (!$renderer)
		{
			$renderer = php_sapi_name() === 'cli' ? 'console' : 'html';
		}

		return $this->setRenderer($renderer)
					->getRenderer()
					->render($this->messages());
	}
142010
public function display(core_backup_renderer $renderer) {

        $html  = '';
        if (!empty($this->results['file_aliases_restore_failures'])) {
            $html .= $renderer->box_start('generalbox filealiasesfailures');
            $html .= $renderer->heading_with_help(get_string('filealiasesrestorefailures', 'core_backup'),
                'filealiasesrestorefailures', 'core_backup');
            $html .= $renderer->container(get_string('filealiasesrestorefailuresinfo', 'core_backup'));
            $html .= $renderer->container_start('aliaseslist');
            $html .= html_writer::start_tag('ul');
            foreach ($this->results['file_aliases_restore_failures'] as $alias) {
                $html .= html_writer::tag('li', s($alias));
            }
            $html .= html_writer::end_tag('ul');
            $html .= $renderer->container_end();
            $html .= $renderer->box_end();
        }
        $html .= $renderer->box_start();
        if (array_key_exists('file_missing_in_backup', $this->results)) {
            $html .= $renderer->notification(get_string('restorefileweremissing', 'backup'), 'notifyproblem');
        }
        $html .= $renderer->notification(get_string('restoreexecutionsuccess', 'backup'), 'notifysuccess');
        $html .= $renderer->continue_button(new moodle_url('/course/view.php', array(
            'id' => $this->get_ui()->get_controller()->get_courseid())), 'get');
        $html .= $renderer->box_end();

        return $html;
    }
392621
private function renderProblem(ResponseInterface $response, ProblemRendererInterface $renderer, HTTPProblem $problem)
    {
        $status = $renderer->status($problem);
        $headers = $renderer->headers($problem);
        $body = $renderer->body($problem);

        foreach ($headers as $name => $value) {
            $response = $response->withHeader($name, $value);
        }

        return $this
            ->withNewBody($response, $body)
            ->withStatus($status);
    }
870808
public function render(AbstractRenderer $renderer = null, $active = null)
    {
        if (is_null($renderer)) {
            $renderer = $this->getRenderer();
        }

        return $renderer->render($this->getRelations(), $active);
    }
1217904
public function render(HTML_QuickForm2_Renderer $renderer)
    {
        foreach ($this->rules as $rule) {
            if ($rule[1] & HTML_QuickForm2_Rule::RUNAT_CLIENT) {
                $renderer->getJavascriptBuilder()->addRule($rule[0]);
            }
        }
        $renderer->renderElement($this);
        return $renderer;
    }
575475
public function render(ProfilerInterface $profiler)
	{
		$render = '';

		/** @var \Joomla\Profiler\ProfilePointInterface $lastPoint **/
		$lastPoint = null;

		$points = $profiler->getPoints();

		foreach ($points as $point)
		{
			$previousTime = $lastPoint ? $lastPoint->getTime() : 0.0;
			$previousMem = $lastPoint ? $lastPoint->getMemoryMegaBytes() : 0;

			$render .= sprintf(
				'<code>%s %.3f seconds (+%.3f); %0.2f MB (%s%0.3f) - %s</code>',
				$profiler->getName(),
				$point->getTime(),
				$point->getTime() - $previousTime,
				$point->getMemoryMegaBytes(),
				($point->getMemoryMegaBytes() > $previousMem) ? '+' : '',
				$point->getMemoryMegaBytes() - $previousMem,
				$point->getName()
			);

			$render .= '<br />';

			$lastPoint = $point;
		}

		return $render;
	}