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

UserMapper::queueUpdate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 11
ccs 0
cts 6
cp 0
crap 2
rs 10
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