CRUDlex\ServiceProvider::readYaml PHP Method

readYaml() protected method

Reads and returns the contents of the given Yaml file. If it goes wrong, it throws an exception.
protected readYaml ( string $fileName ) : array
$fileName string the file to read
return array the file contents
    protected function readYaml($fileName)
    {
        try {
            $fileContent = file_get_contents($fileName);
            $parsedYaml = Yaml::parse($fileContent);
            if (!is_array($parsedYaml)) {
                $parsedYaml = [];
            }
            return $parsedYaml;
        } catch (\Exception $e) {
            throw new \RuntimeException('Could not open CRUD file ' . $fileName, $e->getCode(), $e);
        }
    }