ConfigFinder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A findConfigFile() 0 11 2
1
<?php
2
3
/*
4
 * This file is part of the php-formatter package
5
 *
6
 * Copyright (c) 2014-2016 Marc Morera
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * Feel free to edit as you please, and have fun.
12
 *
13
 * @author Marc Morera <[email protected]>
14
 */
15
16
namespace Mmoreram\PHPFormatter\Finder;
17
18
use Symfony\Component\Yaml\Parser as YamlParser;
19
20
use Mmoreram\PHPFormatter\PHPFormatter;
21
22
/**
23
 * Class ConfigFinder.
24
 */
25
class ConfigFinder
26
{
27
    /**
28
     * Load, if exists, specific project configuration.
29
     *
30
     * @param string $path Path
31
     *
32
     * @return array loaded config
33
     */
34
    public function findConfigFile($path)
35
    {
36
        $configFilePath = rtrim($path, '/') . '/' . PHPFormatter::CONFIG_FILE_NAME;
37
        $config = [];
38
        if (is_file($configFilePath)) {
39
            $yamlParser = new YamlParser();
40
            $config = $yamlParser->parse(file_get_contents($configFilePath));
41
        }
42
43
        return $config;
44
    }
45
}
46