Completed
Push — master ( c1a156...8cadde )
by Kirill
08:14
created

JsonLanguage::colors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 11
loc 11
ccs 0
cts 11
cp 0
crap 2
rs 9.9
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\Console\Language;
11
12
use Railt\Console\Language\Language;
13
use Railt\Io\Readable;
14
15
/**
16
 * Class JsonLanguage
17
 */
18
class JsonLanguage extends Language
19
{
20
    /**
21
     * @return array
22
     */
23 View Code Duplication
    public function tokens(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        return [
26
            'T_STRING'  => '"[^"\\\\]*(\\\\.[^"\\\\]*)*"(?!:)',
27
            'T_KEY'     => '"[^"\\\\]*(\\\\.[^"\\\\]*)*"',
28
            'T_DIGIT'   => '(\d*\.)?\d+',
29
            'T_COMMA'   => ',',
30
            'T_ARR'     => '\[\]',
31
            'T_KEYWORD' => 'null|false|true',
32
            'T_PAIR'    => '[{:}]',
33
        ];
34
    }
35
36
    /**
37
     * @return array
38
     */
39 View Code Duplication
    public function colors(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
40
    {
41
        return [
42
            'T_KEY'     => 'fg=green',
43
            'T_STRING'  => 'fg=yellow',
44
            'T_COMMA'   => 'fg=blue',
45
            'T_KEYWORD' => 'fg=yellow',
46
            'T_ARR'     => 'fg=yellow',
47
            'T_PAIR'    => 'fg=blue;options=bold',
48
        ];
49
    }
50
51
    /**
52
     * @param Readable $file
53
     * @return bool
54
     */
55
    public function match(Readable $file): bool
56
    {
57
        return $this->matchExtension($file, ['json']);
58
    }
59
}
60