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

use Kufer\Web\Classes\Export\ExportCalculation;

abstract class ExportBasisExt extends ExportBasis
{
  public function getVarValue($varname)
  {
    $exportCalc = $this->getExportCalc($this->getVarCategory($varname));
    if (is_null($exportCalc)) {
      return parent::getVarValue($varname);
    }
    $exportResult = $this->getCurrentExportResult();

    return $exportCalc->resolveVar($this->getVarName($varname), $exportResult);
  }

  abstract protected function getExportCalc(string $prefix): ?ExportCalculation\ExportCalc;
}