PhpArray   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromFile() 0 6 2
A fromString() 0 4 1
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
            static::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