Completed
Push — master ( df10c4...80de74 )
by Phil
15:33 queued 08:20
created

NowTimestampDecorator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 16
ccs 0
cts 9
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 3
1
<?php
2
3
namespace Percy\Decorator\Date;
4
5
use DateTime;
6
7
class NowTimestampDecorator implements DecoratorInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function __invoke(EntityInterface $entity, array $properties = [])
13
    {
14
        foreach ($properties as $property) {
15
            if (isset($entity[$property])) {
16
                continue;
17
            }
18
19
            $entity[$property] = (new DateTime)->format('U');
20
        }
21
    }
22
}
23