CommentGetAccessProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 18
ccs 0
cts 7
cp 0
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A resolvedGetters() 0 11 1
1
<?php
2
3
namespace Leonidas\Library\System\Model\Comment;
4
5
use Leonidas\Contracts\System\Model\Comment\CommentInterface;
6
use Leonidas\Contracts\System\Model\GetAccessProviderInterface;
7
use Leonidas\Contracts\System\Schema\Comment\CommentEntityManagerInterface;
8
use Leonidas\Library\System\Model\GetAccessProvider;
9
10
class CommentGetAccessProvider extends GetAccessProvider implements GetAccessProviderInterface
11
{
12
    public function __construct(CommentInterface $comment)
13
    {
14
        parent::__construct($comment, $this->resolvedGetters($comment));
15
    }
16
17
    protected function resolvedGetters(CommentInterface $comment): array
18
    {
19
        $dateFormat = CommentEntityManagerInterface::DATE_FORMAT;
20
21
        $getDate = fn () => $comment->getDate()->format($dateFormat);
22
        $getDateGmt = fn () => $comment->getDateGmt()->format($dateFormat);
23
24
        return [
25
            'date' => $getDate,
26
            'dateGmt' => $getDateGmt,
27
            'date_gmt' => $getDateGmt,
28
        ];
29
    }
30
}
31