Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ArticleCommentsCell | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| display | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | |
| 4 | namespace DefaultTheme\View\Cell; |
| 5 | |
| 6 | use Cake\View\Cell; |
| 7 | |
| 8 | /** |
| 9 | * ArticleComments cell |
| 10 | * |
| 11 | * Handles displaying comments and comment form for articles |
| 12 | * Encapsulates all comment-related presentation logic |
| 13 | */ |
| 14 | class ArticleCommentsCell extends Cell |
| 15 | { |
| 16 | /** |
| 17 | * List of valid options that can be passed into this |
| 18 | * cell's constructor. |
| 19 | * |
| 20 | * @var array<string> |
| 21 | */ |
| 22 | protected array $_validCellOptions = ['article']; |
| 23 | |
| 24 | /** |
| 25 | * Default display method |
| 26 | * |
| 27 | * Sets up comment display and form for an article |
| 28 | * |
| 29 | * @param object $article The article entity with comments |
| 30 | * @return void |
| 31 | */ |
| 32 | public function display(object $article): void |
| 33 | { |
| 34 | $this->set('article', $article); |
| 35 | $this->set('comments', $article->comments ?? []); |
| 36 | } |
| 37 | } |