Exemplo n.º 1
0
 public function format(CellInterface $cell) : string
 {
     if (!$cell->value() instanceof \DateTimeInterface) {
         throw new InvalidArgumentException();
     }
     return $cell->value()->format($this->format);
 }
Exemplo n.º 2
0
 private function position(CellInterface $cell) : self
 {
     $column = $cell->position()->column();
     $row = $cell->position()->row();
     $columns = $this->columns;
     $rows = $this->rows;
     if (!$columns->contains($column)) {
         $columns = $columns->put($column, new Column($column, new Map('scalar', CellInterface::class)));
     }
     if (!$rows->contains($row)) {
         $rows = $rows->put($row, new Row($row, new Map('scalar', CellInterface::class)));
     }
     $columns = $columns->put($column, new Column($column, $columns->get($column)->cells()->put($row, $cell)));
     $rows = $rows->put($row, new Row($row, $rows->get($row)->cells()->put($column, $cell)));
     $sheet = new self($this->name);
     $sheet->rows = $rows;
     $sheet->columns = $columns;
     return $sheet;
 }