From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- .../setup/library/Setup/RequirementsRenderer.php | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 modules/setup/library/Setup/RequirementsRenderer.php (limited to 'modules/setup/library/Setup/RequirementsRenderer.php') diff --git a/modules/setup/library/Setup/RequirementsRenderer.php b/modules/setup/library/Setup/RequirementsRenderer.php new file mode 100644 index 0000000..cc9392a --- /dev/null +++ b/modules/setup/library/Setup/RequirementsRenderer.php @@ -0,0 +1,64 @@ +tags[] = ''; + } + + public function beginChildren(): void + { + $this->tags[] = '
  • '; + $currentSet = $this->getSubIterator(); + $state = $currentSet->getState() ? 'fulfilled' : ($currentSet->isOptional() ? 'not-available' : 'missing'); + $this->tags[] = '
      '; + } + + public function endChildren(): void + { + $this->tags[] = '
    '; + $this->tags[] = '
  • '; + } + + public function render() + { + foreach ($this as $requirement) { + $this->tags[] = '
  • '; + $this->tags[] = '

    ' . $requirement->getTitle() . '

    '; + $this->tags[] = '
    '; + $descriptions = $requirement->getDescriptions(); + if (count($descriptions) > 1) { + $this->tags[] = '
      '; + foreach ($descriptions as $d) { + $this->tags[] = '
    • ' . $d . '
    • '; + } + $this->tags[] = '
    '; + } elseif (! empty($descriptions)) { + $this->tags[] = $descriptions[0]; + } + $this->tags[] = '
    '; + $this->tags[] = '
    ' . $requirement->getStateText() . '
    '; + $this->tags[] = '
  • '; + } + + return implode("\n", $this->tags); + } + + public function __toString() + { + return $this->render(); + } +} -- cgit v1.2.3