Mmoreram\PHPFormatter\Finder\ConfigFinder::findConfigFile PHP Method

findConfigFile() public method

Load, if exists, specific project configuration.
public findConfigFile ( string $path ) : array
$path string Path
return array loaded config
    public function findConfigFile($path)
    {
        $configFilePath = rtrim($path, '/') . '/' . PHPFormatter::CONFIG_FILE_NAME;
        $config = [];
        if (is_file($configFilePath)) {
            $yamlParser = new YamlParser();
            $config = $yamlParser->parse(file_get_contents($configFilePath));
        }
        return $config;
    }

Usage Example

 /**
  * Test right load of config file
  */
 public function testFindConfigFileAndFound()
 {
     $path = dirname(__FILE__) . '/../Mocks/';
     $fileFinder = new ConfigFinder();
     $data = $fileFinder->findConfigFile($path);
     $this->assertEquals($data, array('use-sort' => array('group' => array('Symfony', '_main', 'Mmoreram'), 'group-type' => 'each', 'sort-type' => 'alph', 'sort-direction' => 'desc')));
 }
All Usage Examples Of Mmoreram\PHPFormatter\Finder\ConfigFinder::findConfigFile
ConfigFinder