Flitch\Rule\Manager::loadStandardFile PHP Method

loadStandardFile() protected method

Load a coding standard.
protected loadStandardFile ( string $name ) : array
$name string
return array
    protected function loadStandardFile($name)
    {
        $filename = $this->localPath . '/' . $name . '/standard.ini';
        if (!file_exists($filename)) {
            $filename = $this->globalPath . '/' . $name . '/standard.ini';
            if (!file_exists($filename)) {
                throw new Exception\RuntimeException(sprintf('Could not find standard "%s"', $name));
            }
        }
        if (!is_readable($filename)) {
            throw new Exception\RuntimeException(sprintf('Standard "%s" is not readable', $name));
        }
        $standard = @parse_ini_file($filename, true);
        if ($standard === false) {
            throw new Exception\RuntimeException(sprintf('Could not load standard "%s"', $name));
        }
        if (isset($standard['extends'])) {
            $extends = array_map('trim', explode(',', $standard['extends']));
            foreach ($extends as $extend) {
                $standard = array_replace_recursive($this->loadStandardFile($extend), $standard);
            }
            unset($standard['extends']);
        }
        return $standard;
    }