/** * {@inheritdoc} * @throws ParsingException */ public function build(Sheet $sheet, $yamlContent, Scope $scope) { // Init TwigExecutor with all user functions. $this->twigExecutor = new TwigExecutor($scope->getFunctions()); // Table. $table = new Table(); $sheet->addTable($table); if (isset($yamlContent) && isset($yamlContent['label'])) { $table->setLabel($this->twigExecutor->parse($yamlContent['label'], $scope)); } // Columns. if (!isset($yamlContent) || !array_key_exists('columns', $yamlContent)) { throw new ParsingException("'content' of type 'VerticalTable' must contains 'columns'"); } foreach ($yamlContent['columns'] as $yamlColumn) { $this->parseColumn($table, $yamlColumn, $scope); } // Lines. if (!isset($yamlContent) || !array_key_exists('lines', $yamlContent)) { throw new ParsingException("'content' of type 'VerticalTable' must contains 'lines'"); } foreach ($yamlContent['lines'] as $yamlLine) { $this->parseLine($table, $yamlLine, $scope); } }
/** * {@inheritdoc} */ public function build(Sheet $sheet, $yamlContent, Scope $scope) { $table = new Table(); $table->addLine(new Line()); $sheet->addTable($table); }