forked from openspout/openspout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDateTimeCell.php
More file actions
54 lines (43 loc) · 1.22 KB
/
DateTimeCell.php
File metadata and controls
54 lines (43 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
namespace OpenSpout\Common\Entity\Cell;
use DateTimeInterface;
use OpenSpout\Common\Entity\Cell;
use OpenSpout\Common\Entity\Comment\Comment;
use OpenSpout\Common\Entity\Style\Style;
final readonly class DateTimeCell extends Cell
{
private DateTimeInterface $value;
public function __construct(
DateTimeInterface $value,
?Style $style = null,
?Comment $comment = null,
) {
parent::__construct($style, $comment);
$this->value = $value;
}
public function getValue(): DateTimeInterface
{
return $this->value;
}
public function withValue(DateTimeInterface $value): self
{
return new self($value, $this->style, $this->comment);
}
public function withStyle(Style $style): self
{
return new self($this->value, $style, $this->comment);
}
public function withoutStyle(): self
{
return new self($this->value, null, $this->comment);
}
public function withComment(Comment $comment): self
{
return new self($this->value, $this->style, $comment);
}
public function withoutComment(): self
{
return new self($this->value, $this->style, null);
}
}