Conditions | 3 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
46 | protected function replacePlaceholders($title, $replacedWith) |
||
47 | { |
||
48 | return preg_replace_callback('/(\@)?\{\{([\w\d\.]+)(?:\}\})/', function ($matches) use ($replacedWith) { |
||
49 | if ($matches[1] == '@') { |
||
50 | // Escape |
||
51 | return substr($matches[0], 1); |
||
52 | } |
||
53 | // Find the requested thing |
||
54 | $value = object_get($replacedWith, $matches[2]); |
||
55 | if ($value) { |
||
56 | return $value; |
||
57 | } |
||
58 | |||
59 | // No idea |
||
60 | return $matches[0]; |
||
61 | }, $title); |
||
62 | } |
||
63 | } |