Blade   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromString() 0 12 3
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
        if (empty($options['facade'])) {
20
            $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath'];
21
            $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath);
22
            $string = $bladeCompiler->compileString($string);
23
        } else {
24
            $string = $options['facade']::compileString($string);
25
        }
26
27
        PhpCode::fromString($string, $translations, $options);
28
    }
29
}
30