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.

ProjectTransformer::transform()   B
last analyzed

Complexity

Conditions 6
Paths 32

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 4
Bugs 0 Features 2
Metric Value
dl 0
loc 15
ccs 0
cts 13
cp 0
rs 8.8571
c 4
b 0
f 2
cc 6
eloc 10
nc 32
nop 0
crap 42
1
<?php
2
/**
3
 * This file is part of the Gerrie package.
4
 *
5
 * (c) Andreas Grunwald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Gerrie\Transformer;
12
13
class ProjectTransformer extends BaseTransformer
14
{
15
16
    /**
17
     * Supported index names returned by the Gerrie API.
18
     *
19
     * @var array
20
     */
21
    protected $supportedKeys = [
22
        'id',
23
        // _name is a self added key by Gerrie. This is not a key received by the Gerrit API!
24
        '_name',
25
        'description',
26
        'parent',
27
        'kind',
28
        'state'
29
    ];
30
31
    /**
32
     * Transforms the data into one unique format
33
     *
34
     * @return array
35
     */
36
    public function transform()
37
    {
38
        $data = $this->getData();
39
40
        $transformedData = [
41
            'identifier' => ((isset($data['id']) === true) ? $data['id'] : ''),
42
            'name' => $data['_name'],
43
            'description' => ((isset($data['description']) === true) ? $data['description'] : ''),
44
            'kind' => ((isset($data['kind']) === true) ? $data['kind'] : ''),
45
            'state' => ((isset($data['state']) === true) ? $data['state'] : ''),
46
            'parent' => ((isset($data['parent']) === true) ? $data['parent'] : '')
47
        ];
48
49
        return $transformedData;
50
    }
51
}