Completed
Push — master ( 11ad20...a09f6d )
by Sergi Tur
05:23
created

StubFileCompiler::compile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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