Completed
Push — master ( 498785...489d0f )
by Josh
03:01
created

DataArraySerializer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 38
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A collection() 0 4 1
A item() 0 4 1
A null() 0 6 1
1
<?php
2
3
namespace NavJobs\Transmit\Serializers;
4
5
use League\Fractal\Serializer\ArraySerializer as BaseArraySerializer;
6
7
class DataArraySerializer extends BaseArraySerializer
8
{
9
    /**
10
     * Serialize a collection.
11
     *
12
     * @param string $resourceKey
13
     * @param array  $data
14
     *
15
     * @return array
16
     */
17
    public function collection($resourceKey, array $data)
18
    {
19
        return ['data' => $data];
20
    }
21
22
    /**
23
     * Serialize an item.
24
     *
25
     * @param string $resourceKey
26
     * @param array  $data
27
     *
28
     * @return array
29
     */
30
    public function item($resourceKey, array $data)
31
    {
32
        return ['data' => $data];
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function null()
39
    {
40
        return [
41
            'data' => null,
42
        ];
43
    }
44
}
45