private function readSavedTranslations()
    {
        if (!is_file($this->absPath) || !is_readable($this->absPath)) {
            return null;
        }

        try {
            $savedTranslations = Yaml::parse(file_get_contents($this->absPath), true);
        } catch (ParseException $e) {
            $this->app['logger.flash']->danger('Unable to parse the YAML translations' . $e->getMessage());

            return null;
        }

        if ($savedTranslations === null) {
            return []; // File seems to be empty
        } elseif (!is_array($savedTranslations)) {
            $savedTranslations = [$savedTranslations]; // account for file with one lin
        }

        $flatten = function ($data, $prefix = '') use (&$flatten, &$flattened) {
            if ($prefix) {
                $prefix .= '.';
            }
            foreach ($data as $key => $value) {
                if (is_array($value)) {
                    $flatten($value, $prefix . $key);
                } else {
                    $flattened[$prefix . $key] = ($value === null) ? '' : $value;
                }
            }
        };
        $flattened = [];
        $flatten($savedTranslations);

        return $flattened;
    }
private function readSavedTranslations()
    {
        if (!is_file($this->absPath) || !is_readable($this->absPath)) {
            return null;
        }

        try {
            $savedTranslations = Yaml::parse(file_get_contents($this->absPath), true);
        } catch (ParseException $e) {
            $this->app['logger.flash']->danger('Unable to parse the YAML translations' . $e->getMessage());

            return null;
        }

        if ($savedTranslations === null) {
            return []; // File seems to be empty
        } elseif (!is_array($savedTranslations)) {
            $savedTranslations = [$savedTranslations]; // account for file with one lin
        }

        $flatten = function ($data, $prefix = '') use (&$flatten, &$flattened) {
            if ($prefix) {
                $prefix .= '.';
            }
            foreach ($data as $key => $value) {
                if (is_array($value)) {
                    $flatten($value, $prefix . $key);
                } else {
                    $flattened[$prefix . $key] = ($value === null) ? '' : $value;
                }
            }
        };
        $flattened = [];
        $flatten($savedTranslations);

        return $flattened;
    }
private function readSavedTranslations ( ) { if ( ! is_file ( $ this -> absPath ) || ! is_readable ( $ this -> absPath ) ) { return null ; } try { $ savedTranslations = Yaml :: parse ( file_get_contents ( $ this -> absPath ) , true ) ; } catch ( ParseException $ e ) { $ this -> app [ 'logger.flash' ] -> danger ( 'Unable to parse the YAML translations' . $ e -> getMessage ( ) ) ; return null ; } if ( $ savedTranslations === null ) { return [ ] ; // File seems to be empty } elseif ( ! is_array ( $ savedTranslations ) ) { $ savedTranslations = [ $ savedTranslations ] ; // account for file with one lin } $ flatten = function ( $ data , $ prefix = '' ) use ( & $ flatten , & $ flattened ) { if ( $ prefix ) { $ prefix .= '.' ; } foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ flatten ( $ value , $ prefix . $ key ) ; } else { $ flattened [ $ prefix . $ key ] = ( $ value === null ) ? '' : $ value ; } } } ; $ flattened = [ ] ; $ flatten ( $ savedTranslations ) ; return $ flattened ; }
Parses translations file and returns translations.

@return array|null Translations found
Parses translations file and returns translations .