Passed
Push — master ( 7783b2...f247da )
by Kacper
02:40
created

Scss   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 4
dl 0
loc 19
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) 2016, 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\Css;
17
18
19
use Kadet\Highlighter\Language\Css;
20
use Kadet\Highlighter\Matcher\RegexMatcher;
21
use Kadet\Highlighter\Matcher\SubStringMatcher;
22
use Kadet\Highlighter\Parser\Rule;
23
24
class Scss extends Css
25
{
26
    public function getRules()
27
    {
28
        $rules = parent::getRules();
29
        $rules['symbol.selector.tag'] = new Rule(new RegexMatcher('/(?>[\s{};]|^)(?=(\w+).*\{)/m'), ['context' => Rule::everywhere()]);
30
        $rules['symbol.selector.class']->setContext(Rule::everywhere());
31
        $rules['symbol.selector.class.pseudo']->setContext(Rule::everywhere());
32
        $rules['symbol.selector.id']->setContext(Rule::everywhere());
33
        $rules['variable'] = new Rule(new RegexMatcher('/(\$[\w-]+)/'), ['context' => Rule::everywhere()]);
34
        $rules['operator.self'] = new Rule(new SubStringMatcher('&'), ['context' => Rule::everywhere()]);
35
        return $rules;
36
    }
37
38
    public function getIdentifier()
39
    {
40
        return 'scss';
41
    }
42
}