ModelFormLayer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A saveCreatedAt() 0 3 1
A loadCreatedAt() 0 3 2
A getEntityClass() 0 3 1
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\Model;
10
11
class ModelFormLayer extends EntityFormLayer
12
{
13
    public $content;
14
    public $createdAt;
15
16
    public static function getEntityClass(): string
17
    {
18
        return Model::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