Blade::fromString()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 3
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Gettext\Extractors;
4
5
use Gettext\Translations;
6
use Illuminate\Filesystem\Filesystem;
7
use Illuminate\View\Compilers\BladeCompiler;
8
9
/**
10
 * Class to get gettext strings from blade.php files returning arrays.
11
 */
12
class Blade extends Extractor implements ExtractorInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public static function fromString($string, Translations $translations, array $options = [])
18
    {
19
        $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath'];
20
        $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath);
21
        $string = $bladeCompiler->compileString($string);
22
23
        PhpCode::fromString($string, $translations, $options);
24
    }
25
}
26