Author.php
2 days ago
CommentLink.php
2 days ago
CommentObject.php
2 days ago
CommentText.php
2 days ago
Content.php
2 days ago
LinkableCommentDate.php
2 days ago
Meta.php
2 days ago
MetaDateAndAuthor.php
2 days ago
ParentId.php
2 days ago
Property.php
2 days ago
ReplyToLink.php
2 days ago
StatusLabel.php
2 days ago
UserId.php
2 days ago
CommentObject.php
25 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Formatter\Comment; |
| 6 | |
| 7 | use AC\Exception\ValueNotFoundException; |
| 8 | use AC\Formatter; |
| 9 | use AC\Type\Value; |
| 10 | |
| 11 | class CommentObject implements Formatter |
| 12 | { |
| 13 | public function format(Value $value) |
| 14 | { |
| 15 | $comment = get_comment($value->get_id()); |
| 16 | |
| 17 | if (! $comment) { |
| 18 | throw ValueNotFoundException::from_id($value->get_id()); |
| 19 | } |
| 20 | |
| 21 | return $value->with_value($comment); |
| 22 | } |
| 23 | |
| 24 | } |
| 25 |