Completed
Push — master ( d9d1e2...b73c31 )
by Ruben
01:14
created

LayeredSerializer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 13 2
1
<?php
2
3
namespace Spatie\ResourceLinks\Serializers;
4
5
class LayeredSerializer implements Serializer
6
{
7
    public function format(LinkContainer $linkContainer): array
8
    {
9
        $format = [
10
            $linkContainer->name => [
11
                'method' => $linkContainer->method,
12
                'action' => $linkContainer->action,
13
            ],
14
        ];
15
16
        return is_null($linkContainer->prefix)
17
            ? $format
18
            : [$linkContainer->prefix => $format];
19
    }
20
}
21