Passed
Branch fuck-54 (abba45)
by Kacper
02:24
created

Ini   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRules() 0 11 1
A getIdentifier() 0 4 1
1
<?php
2
/**
3
 * Highlighter
4
 *
5
 * Copyright (C) 2015, Some right reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Highlighter\Language;
17
18
19
use Kadet\Highlighter\Matcher\CommentMatcher;
20
use Kadet\Highlighter\Matcher\RegexMatcher;
21
use Kadet\Highlighter\Parser\Rule;
22
23
class Ini extends Language
24
{
25
    /** @inheritdoc */
26
    public function getRules()
27
    {
28
        return [
29
            'comment'        => new Rule(new CommentMatcher([';'], [])),
30
            'symbol.section' => new Rule(new RegexMatcher('/(\[[\.\w]+\])/i')),
31
            'variable'       => new Rule(new RegexMatcher('/([\.\w]+)\s*=/i')),
32
            'number'         => new Rule(new RegexMatcher('/(-?\d+)/i')),
33
34
            'string' => new Rule(new RegexMatcher('/=\h*(.*)/i')),
35
        ];
36
    }
37
38
    /** @inheritdoc */
39
    public function getIdentifier()
40
    {
41
        return 'ini';
42
    }
43
}