@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | protected $what; |
39 | 39 | |
40 | 40 | function __construct($s, Text $what) { |
41 | - if(preg_match("/^([a-z]+)(\\((.*)\\))?$/", $s, $m)) { |
|
41 | + if (preg_match("/^([a-z]+)(\\((.*)\\))?$/", $s, $m)) { |
|
42 | 42 | $this->filter = $m[1]; |
43 | 43 | $this->vars = isset($m[3]) ? explode(',', $m[3]) : []; |
44 | 44 | } else { |
45 | 45 | throw new ParseError("Unable to parse filter expression \"$s\""); |
46 | 46 | } |
47 | - if(!in_array($this->filter, ['itersplit', 'newlinebr', 'round', 'strtoupper', 'strtolower', 'ucfirst'])) { |
|
47 | + if (!in_array($this->filter, ['itersplit', 'newlinebr', 'round', 'strtoupper', 'strtolower', 'ucfirst'])) { |
|
48 | 48 | throw new ParseError("Unknown Filter Type \"{$this->filter}\""); |
49 | 49 | } |
50 | - switch($this->filter) { |
|
50 | + switch ($this->filter) { |
|
51 | 51 | case "itersplit": |
52 | 52 | $this->filter = "Seufert\\Hamle\\Text\\Filter::iterSplit"; |
53 | 53 | break; |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | function toHTML($escape = false) { |
62 | - if($escape) |
|
63 | - return "<?=htmlspecialchars(" .$this->toPHP() . ")?>"; |
|
62 | + if ($escape) |
|
63 | + return "<?=htmlspecialchars(" . $this->toPHP() . ")?>"; |
|
64 | 64 | return "<?=" . $this->toPHP() . "?>"; |
65 | 65 | } |
66 | 66 | |
67 | 67 | function toPHP() { |
68 | - $o = [$this->what->toPHPVar()] ; |
|
69 | - foreach($this->vars as $v) |
|
68 | + $o = [$this->what->toPHPVar()]; |
|
69 | + foreach ($this->vars as $v) |
|
70 | 70 | $o[] = $this->varToCode($v); |
71 | - return "{$this->filter}(" . implode(',',$o) . ")"; |
|
71 | + return "{$this->filter}(" . implode(',', $o) . ")"; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | static function iterSplit($v, $sep = ",") { |
75 | 75 | $o = []; |
76 | - foreach(explode($sep, $v) as $k=>$i) { |
|
77 | - if($i) |
|
78 | - $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k,'key'=>$k]; |
|
76 | + foreach (explode($sep, $v) as $k=>$i) { |
|
77 | + if ($i) |
|
78 | + $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k, 'key'=>$k]; |
|
79 | 79 | } |
80 | 80 | return new WrapArray($o); |
81 | 81 | } |
82 | 82 | |
83 | 83 | static function newlineBr($v) { |
84 | - return str_replace("\n","<br />\n",$v); |
|
84 | + return str_replace("\n", "<br />\n", $v); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | } |
88 | 88 | \ No newline at end of file |