Completed
Push — master ( e17663...92cd4a )
by Oscar
02:00
created

PhpArray::extract()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 1 Features 0
Metric Value
cc 3
eloc 6
c 5
b 1
f 0
nc 4
nop 2
dl 0
loc 12
rs 9.4285
1
<?php
2
3
namespace Gettext\Extractors;
4
5
use BadMethodCallException;
6
use Gettext\Translations;
7
use Gettext\Utils\MultidimensionalArrayTrait;
8
9
/**
10
 * Class to get gettext strings from php files returning arrays.
11
 */
12
class PhpArray extends Extractor implements ExtractorInterface
13
{
14
    use MultidimensionalArrayTrait;
15
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public static function fromFile($file, Translations $translations, array $options = [])
20
    {
21
        foreach (static::getFiles($file) as $file) {
22
            self::fromArray(include($file), $translations);
23
        }
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public static function fromString($string, Translations $translations, array $options = [])
30
    {
31
        throw new BadMethodCallException('PhpArray::fromString() cannot be called. Use PhpArray::fromFile()');
32
    }
33
}
34