@@ 9-43 (lines=35) @@ | ||
6 | use Spreadsheet\Exception\InvalidArgumentException; |
|
7 | use Innmind\Immutable\MapInterface; |
|
8 | ||
9 | final class Column implements ColumnInterface |
|
10 | { |
|
11 | private $identifier; |
|
12 | private $cells; |
|
13 | ||
14 | public function __construct($identifier, MapInterface $cells) |
|
15 | { |
|
16 | if ( |
|
17 | !is_scalar($identifier) || |
|
18 | (string) $cells->keyType() !== 'scalar' || |
|
19 | (string) $cells->valueType() !== CellInterface::class |
|
20 | ) { |
|
21 | throw new InvalidArgumentException; |
|
22 | } |
|
23 | ||
24 | $this->identifier = $identifier; |
|
25 | $this->cells = $cells; |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * {@inheritdoc} |
|
30 | */ |
|
31 | public function identifier() |
|
32 | { |
|
33 | return $this->identifier; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | public function cells(): MapInterface |
|
40 | { |
|
41 | return $this->cells; |
|
42 | } |
|
43 | } |
|
44 |
@@ 9-43 (lines=35) @@ | ||
6 | use Spreadsheet\Exception\InvalidArgumentException; |
|
7 | use Innmind\Immutable\MapInterface; |
|
8 | ||
9 | final class Row implements RowInterface |
|
10 | { |
|
11 | private $identifier; |
|
12 | private $cells; |
|
13 | ||
14 | public function __construct($identifier, MapInterface $cells) |
|
15 | { |
|
16 | if ( |
|
17 | !is_scalar($identifier) || |
|
18 | (string) $cells->keyType() !== 'scalar' || |
|
19 | (string) $cells->valueType() !== CellInterface::class |
|
20 | ) { |
|
21 | throw new InvalidArgumentException; |
|
22 | } |
|
23 | ||
24 | $this->identifier = $identifier; |
|
25 | $this->cells = $cells; |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * {@inheritdoc} |
|
30 | */ |
|
31 | public function identifier() |
|
32 | { |
|
33 | return $this->identifier; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | public function cells(): MapInterface |
|
40 | { |
|
41 | return $this->cells; |
|
42 | } |
|
43 | } |
|
44 |