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

StubFileCompiler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A compile() 0 8 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
}