GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Serializer::collection()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 2
ccs 3
cts 3
cp 1
crap 3
1
<?php
2
3
namespace EllipseSynergie\ApiResponse\Serializer;
4
5
use League\Fractal\Serializer\ArraySerializer;
6
7
/**
8
 * Class Serializer
9
 * @package EllipseSynergie\ApiResponse\Serializer
10
 * @author Maxime Beaudoin <[email protected]>
11
 */
12
class Serializer extends ArraySerializer
13
{
14
    const RESOURCE_KEY = 'data';
15
16
    /**
17
     * Serialize a collection.
18
     *
19
     * @param string $resourceKey
20
     * @param array  $data
21
     *
22
     * @return array
23
     */
24 4
    public function collection($resourceKey, array $data)
25
    {
26 4
        if (is_null($resourceKey)) $resourceKey = static::RESOURCE_KEY;
27 4
        return $resourceKey ? [$resourceKey => $data]: $data;
28
    }
29
30
    /**
31
     * Serialize an item.
32
     *
33
     * @param string $resourceKey
34
     * @param array  $data
35
     *
36
     * @return array
37
     */
38 2
    public function item($resourceKey, array $data)
39
    {
40 2
        if (is_null($resourceKey)) $resourceKey = static::RESOURCE_KEY;
41 2
        return $resourceKey ? [$resourceKey => $data]: $data;
42
    }
43
}
44