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.

TransformerFactory::getTransformer()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
ccs 0
cts 9
cp 0
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 6
nc 2
nop 2
crap 6
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 TransformerFactory
14
{
15
16
    /**
17
     * Creates a new (data) transformer
18
     *
19
     * @param string $entity Entity / name of data to transform (singular)
20
     * @param bool $debug
21
     * @return TransformerInterface
22
     */
23
    public function getTransformer($entity, $debug = false)
24
    {
25
        $className = 'Gerrie\\Transformer\\' . $entity . 'Transformer';
26
        $transformer = new $className();
27
28
        if ($debug === true) {
29
            $transformer = new DebugTransformDecorator($transformer);
30
        }
31
32
        return $transformer;
33
    }
34
}