StringTagAppendar   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A appendAround() 0 10 4
1
<?php
2
3
/*
4
 * This file is part of the Html Tag Appendar
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 HtmlTagAppendar;
13
14
class StringTagAppendar {    
15
16
    /**
17
     * @param string $content
18
     * @param string $string
19
     * @param string $tag
20
     * 
21
     * @return string
22
     */
23
    public function appendAround($content, $string, $tag) {
24
        
25
        if(!empty($content) && !empty($string) && !empty($tag)) {
26
            $htmltag = str_replace('<', '', str_replace('>', '', $tag));
27
            
28
            return preg_replace(array('/'.$string.'/i'), array('<'.$htmltag.'>'.$string.'</'.$htmltag.'>'), $content);
29
        }
30
        
31
        return $content;
32
    }
33
    
34
}
35