Passed
Push — master ( 961468...052950 )
by Theo
01:43
created

Serializer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 9 2
1
<?php
2
3
namespace CalendarBundle\Serializer;
4
5
use CalendarBundle\Entity\Event;
6
7
class Serializer implements SerializerInterface
8
{
9
    /**
10
     * @param Event[] $events
11
     *
12
     * @return string json
13
     */
14 2
    public function serialize(array $events): string
15
    {
16 2
        $result = [];
17
18 2
        foreach ($events as $event) {
19 1
            $result[] = $event->toArray();
20
        }
21
22 2
        return json_encode($result);
23
    }
24
}
25