public static function createByFilePath($filepath) : Repository
    {
        $filename = basename($filepath);
        list($domain, $language, $extension) = explode('.', $filename, 3);

        $yamlParser = new YamlParser();
        $data = $yamlParser->parse(file_get_contents($filepath));

        $emptyArray = [];
        $translations = [];
        self::createPlainRepresentationByArray(
            $translations,
            $language,
            ($data) ?: [],
            $emptyArray,
            ''
        );

        $translationCollection = TranslationCollection::create($translations);

        return new self(
            $translationCollection,
            $filepath,
            $language,
            $domain
        );
    }
public static function createByFilePath($filepath) : Repository
    {
        $filename = basename($filepath);
        list($domain, $language, $extension) = explode('.', $filename, 3);

        $yamlParser = new YamlParser();
        $data = $yamlParser->parse(file_get_contents($filepath));

        $emptyArray = [];
        $translations = [];
        self::createPlainRepresentationByArray(
            $translations,
            $language,
            ($data) ?: [],
            $emptyArray,
            ''
        );

        $translationCollection = TranslationCollection::create($translations);

        return new self(
            $translationCollection,
            $filepath,
            $language,
            $domain
        );
    }
public static function createByFilePath ( $ filepath ) : Repository { $ filename = basename ( $ filepath ) ; list ( $ domain , $ language , $ extension ) = explode ( '.' , $ filename , 3 ) ; $ yamlParser = new YamlParser ( ) ; $ data = $ yamlParser -> parse ( file_get_contents ( $ filepath ) ) ; $ emptyArray = [ ] ; $ translations = [ ] ; self :: createPlainRepresentationByArray ( $ translations , $ language , ( $ data ) ? : [ ] , $ emptyArray , '' ) ; $ translationCollection = TranslationCollection :: create ( $ translations ) ; return new self ( $ translationCollection , $ filepath , $ language , $ domain ) ; }
Create a new repository given a file path.

@param string $filepath

@return Repository
Create a new repository given a file path .