UuidDecorator::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Percy\Decorator;
4
5
use Percy\Entity\EntityInterface;
6
use Ramsey\Uuid\Uuid;
7
8
class UuidDecorator implements DecoratorInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 1
    public function __invoke(EntityInterface $entity, array $properties = [])
14
    {
15 1
        foreach ($properties as $property) {
16 1
            $entity[$property] = Uuid::uuid4()->toString();
17 1
        }
18 1
    }
19
}
20