HighLighter   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A HighLight() 0 12 3
1
<?php
2
3
/*
4
 * This file is part of the Link/Email HighLighter Package
5
 *
6
 * (c) Nexuslink Services
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LinkEmailHighLighter;
13
14
use Symfony\Component\Yaml\Yaml;
15
use LinkEmailHighLighter\src\Services\LinkHighLighter;
16
use LinkEmailHighLighter\src\Services\MailToHighLighter;
17
18
class HighLighter {
19
20
    private $pathToYml;
21
22
    public function __construct($pathToYml = '') {
23
24
        if (!empty($pathToYml)) {
25
            $this->pathToYml = $pathToYml;
26
        } else {
27
            $this->pathToYml = __DIR__ . "\Resources\config\config.yml";
28
        }
29
    }
30
31
    /**
32
     * 
33
     * @param string $content
34
     * @return string
35
     */
36
    public function HighLight($content) {
37
38
        $configArray = Yaml::parse(file_get_contents($this->pathToYml));
39
40
        if ($configArray['highlighting_enabled']['link']) {
41
            $content = LinkHighlighter::replaceWebLinks($content);
42
        }
43
        if ($configArray['highlighting_enabled']['mail']) {
44
            $content = MailToHighlighter::replaceMailTo($content);
45
        }
46
        return $content;
47
    }
48
    
49
}
50