<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

namespace Kufer\Web\Classes\Ampel\Renderer;

abstract class AmpelRendererText implements AmpelRenderer
{
  abstract protected function isValidStatus(int $status): bool;

  public function create(int $status): string
  {
    if ($status < 0 || $status > 3) {
      return '';
    }
    $settings = \ToolSettingsAPI::getToolSettings(4);
    $optionstatus = $status + 1;
    $out_text = $settings->{'optionstatustext' . $optionstatus};

    return '<span class="wbampel status' . \CleanOperations::cleanInt($status) . '">' . \CleanOperations::cleanStringForHtml($out_text) . '</span>';
  }
}