src/V4/Dev/Exporter/TraceableExportBuilder.php line 44

Open in your IDE?
  1. <?php
  2. namespace App\V4\Dev\Exporter;
  3. use App\Export\Builder\ExportBuilder;
  4. use App\Export\Builder\ExportBuilderInterface;
  5. use App\Export\Builder\ExporterInterface;
  6. use RuntimeException;
  7. use Symfony\Component\Stopwatch\Stopwatch;
  8. class TraceableExportBuilder implements ExportBuilderInterface
  9. {
  10.     /**
  11.      * @var ExportBuilder
  12.      */
  13.     private $decorated;
  14.     /**
  15.      * @var Stopwatch
  16.      */
  17.     private $stopwatch;
  18.     /**
  19.      * @param ExportBuilder $decorated
  20.      * @param Stopwatch     $stopwatch
  21.      */
  22.     public function __construct(ExportBuilder $decoratedStopwatch $stopwatch)
  23.     {
  24.         $this->decorated $decorated;
  25.         $this->stopwatch $stopwatch;
  26.     }
  27.     /**
  28.      * @param mixed  $entity
  29.      * @param string $field
  30.      * @param string $exportType
  31.      *
  32.      * @return ExporterInterface
  33.      *
  34.      * @throws RuntimeException
  35.      */
  36.     public function getExporter($entitystring $fieldstring $exportType): ExporterInterface
  37.     {
  38.         $exporter $this->decorated->getExporter($entity$field$exportType);
  39.         return new TraceableExporter($exporter$this->stopwatch);
  40.     }
  41. }