Passed
Push — master ( 13b2de...e5b260 )
by Alexander
04:42
created

UserMapper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 6
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A queueUpdate() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\User;
6
7
use Cycle\ORM\Command\ContextCarrierInterface;
8
use Cycle\ORM\Command\Database\Update;
9
use Cycle\ORM\Heap\Node;
10
use Cycle\ORM\Heap\State;
11
use Cycle\ORM\Mapper\Mapper;
12
13
final class UserMapper extends Mapper
14
{
15
    /**
16
     * @param User $entity
17
     */
18
    public function queueUpdate($entity, Node $node, State $state): ContextCarrierInterface
19
    {
20
        /** @var Update $command */
21
        $command = parent::queueUpdate($entity, $node, $state);
22
23
        $now = new \DateTimeImmutable();
24
25
        $state->register('updated_at', $now, true);
26
        $command->registerAppendix('updated_at', $now);
27
28
        return $command;
29
    }
30
}
31