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.
Completed
Push — master ( 7f5f8b...23b9d8 )
by Bruno
04:20
created

ColorManager::makeColorString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: bheron
5
 * Date: 25/07/2016
6
 * Time: 01:06
7
 */
8
9
namespace Onurb\Doctrine\ORMMetadataGrapher\YumlMetadataGrapher;
10
11
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
12
13
class ColorManager implements ColorManagerInterface
14
{
15
    /**
16
     * @var StringGeneratorInterface
17
     */
18
    private $stringGenerator;
19
20
    /**
21
     * @var ClassStoreInterface
22
     */
23
    private $classStore;
24
25
    /**
26
     * @var array
27
     */
28
    private $str = array();
29
30
    /**
31
     * @param StringGeneratorInterface $stringGenerator
32
     * @param ClassStoreInterface $classStore
33
     */
34 2
    public function __construct(StringGeneratorInterface $stringGenerator, ClassStoreInterface $classStore)
35
    {
36 2
        $this->stringGenerator = $stringGenerator;
37 2
        $this->classStore = $classStore;
38 2
    }
39
40
    /**
41
     * @param ClassMetadata[] $metadata
42
     * @param array $colors color strings
43
     * @return string
44
     */
45 1
    public function getColorStrings($metadata, $colors)
46
    {
47 1
        $this->classStore->storeColors($colors);
48
49 1
        foreach ($metadata as $class) {
50 1
            $color = $this->classStore->getClassColor($class->getName());
51 1
            if (null !== $color) {
52 1
                $this->str[] = self::makeColorString($this->stringGenerator->getClassString($class), $color);
53 1
            }
54 1
        }
55
56 1
        return $this->str;
57
    }
58
59
    /**
60
     * @param string $classString
61
     * @param string $color
62
     * @return string
63
     */
64 1
    private static function makeColorString($classString, $color)
65
    {
66 1
        return str_replace(']', '{bg:'. $color .'}]', $classString);
67
    }
68
}
69