Completed
Branch 4.0 (c710b5)
by Serhii
02:04
created

YamlStorage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 11 2
1
<?php
2
/**
3
 * @author Serhii Nekhaienko <[email protected]>
4
 * @license GPL
5
 * @copyright Serhii Nekhaienko &copy 2018
6
 * @version 4.0.0
7
 * @project browser-detector
8
 */
9
10
namespace EndorphinStudio\Detector\Storage;
11
12
use Symfony\Component\Yaml\Parser;
13
use Symfony\Component\Yaml\Yaml;
14
15
/**
16
 * Class YamlStorage
17
 * Provide data files reader from yaml files
18
 * Use symfony\yaml component
19
 * @package EndorphinStudio\Detector\Storage
20
 */
21
class YamlStorage extends FileStorage implements StorageInterface
22
{
23
    /**
24
     * Get array of Data
25
     * @return array array of data
26
     */
27
    public function getConfig(): array
28
    {
29
        $yamlParser = new Parser();
30
        $files = $this->getFileNames();
31
        $config = [];
32
        foreach ($files as $file) {
33
            $fileConfig = $yamlParser->parseFile($file);
34
            $config = \array_merge($config, $fileConfig);
35
        }
36
        return $config;
37
    }
38
}