Debian Codegraph @

vendor/sabberworm/php-css-parser/src/Comment/CommentContainer.php

raw
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Sabberworm\CSS\Comment;
6
7 /**
8 * Provides a standard reusable implementation of `Commentable`.
9 *
10 * @internal
11 *
12 * @phpstan-require-implements Commentable
13 */
14 trait CommentContainer
15 {
16 /**
17 * @var list<Comment>
18 */
19 protected $comments = [];
20
21 /**
22 * @param list<Comment> $comments
23 */
24 public function addComments(array $comments): void
25 {
26 $this->comments = \array_merge($this->comments, $comments);
27 }
28
29 /**
30 * @return list<Comment>
31 */
32 public function getComments(): array
33 {
34 return $this->comments;
35 }
36
37 /**
38 * @param list<Comment> $comments
39 */
40 public function setComments(array $comments): void
41 {
42 $this->comments = $comments;
43 }
44 }