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

Ini::getIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
}