NodeFormLayer::saveCreatedAt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Pfilsx\FormLayer\Tests\app\FormLayer;
5
6
7
use DateTime;
8
use Pfilsx\FormLayer\Layer\EntityFormLayer;
9
use Pfilsx\FormLayer\Tests\app\Entity\Node;
10
11
class NodeFormLayer extends EntityFormLayer
12
{
13
    public $content;
14
    public $createdAt;
15
16
    public static function getEntityClass(): string
17
    {
18
        return Node::class;
19
    }
20
21
    protected function loadCreatedAt(?DateTime $val)
22
    {
23
        $this->createdAt = $val !== null ? $val->format('d.m.Y') : $val;
24
    }
25
26
    protected function saveCreatedAt()
27
    {
28
        return new DateTime($this->createdAt);
29
    }
30
}
31