Passed
Push — master ( 02118d...11fb63 )
by Petr
03:00
created

TEntityChanged::ifEntryChanged()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
namespace kalanis\kw_mapper\Mappers\Shared;
4
5
6
use kalanis\kw_mapper\Interfaces\IEntryType;
7
use kalanis\kw_mapper\Records\Entry;
8
9
10
/**
11
 * Trait TEntityChanged
12
 * @package kalanis\kw_mapper\Mappers\Shared
13
 * Check if value has been changed and will be changed
14
 */
15
trait TEntityChanged
16
{
17
    /**
18
     * @param Entry $entry
19
     * @return bool
20
     */
21 36
    protected function ifEntryChanged(Entry $entry): bool
22
    {
23 36
        $toCompare = $entry->getData();
24 36
        return (IEntryType::TYPE_BOOLEAN == $entry->getType())
25 5
            ? !is_null($toCompare)
26 36
            : (false !== $toCompare)
27
        ;
28
    }
29
}
30