Completed
Push — trunk ( 062c60...ebaef8 )
by SuperNova.WS
11:27 queued 05:24
created

AllianceHelper::formatText()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by Gorlum 11.11.2018 4:57
4
 */
5
6
namespace Alliance;
7
8
class AllianceHelper {
9
  protected static $patterns = [
10
//    "#\[fc\]([a-z0-9\#]+)\[/fc\](.*?)\[/f\]#Ssi" => '<font color="\1">\2</font>',
11
    "#\[fc\]([a-z0-9\#]+)\[/fc\](.*?)\[/f\]#Ssi" => '<span style="color:\1">\2</span>',
12
    '#\[img\](.*?)\[/img\]#Smi'                  => '<img src="\1" alt="\1" style="border:0;" />',
13
//    "#\[fc\]([a-z0-9\#\ \[\]]+)\[/fc\]#Ssi"      => '<font color="\1">',
14
//    "#\[/f\]#Ssi"                                => '</font>',
15
    "#\[fc\]([a-z0-9\#\ \[\]]+)\[/fc\]#Ssi"      => '<span style="color:\1">',
16
    "#\[/f\]#Ssi"                                => '</span>',
17
  ];
18
19
  public static function formatText($text) {
20
    return nl2br(preg_replace(array_keys(self::$patterns), self::$patterns, $text));
21
  }
22
23
}
24