RCFileCompiler::compile()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Acacha\ForgePublish\Compiler;
4
5
/**
6
 * Class RCFileCompiler.
7
 *
8
 * @package Acacha\ForgePublish\Compiler
9
 */
10
class RCFileCompiler
11
{
12
13
    /**
14
     * Compile the template using the given data.
15
     *
16
     * @param $template
17
     * @param $data
18
     * @return mixed
19
     */
20
    public function compile($template, $data)
21
    {
22
        foreach ($data as $key => $value) {
23
            $template = preg_replace("/\\$$key\\$/i", $value, $template);
24
        }
25
        return $template;
26
    }
27
}
28