<commit_before><?php namespace Modules\Translation\Repositories\File;

use Illuminate\Filesystem\Filesystem;
use Modules\Translation\Repositories\FileTranslationRepository as FileTranslationRepositoryInterface;

class FileTranslationRepository implements FileTranslationRepositoryInterface
{
    /**
     * @var Filesystem
     */
    private $finder;

    public function __construct(Filesystem $finder)
    {
        $this->finder = $finder;
    }

    /**
     * Get all the translations for all modules on disk
     * @return array
     */
    public function all()
    {
        $allFileTranslations = [];
        $files = $this->finder->allFiles($this->getTranslationsDirectory());
        foreach ($files as $file) {
            $lang = $this->getLanguageFrom($file->getRelativePath());
            $path = $file->getRelativePathname();
            $contents = $this->finder->getRequire($this->getTranslationsDirectory() . '/' . $path);
            $trans = array_dot($contents, $this->getModuleFrom($file->getRelativePath()) . '::' . $this->getFileNameFrom($path) . '.');
            foreach ($trans as $key => $value) {
                $allFileTranslations[$lang][$key] = $value;
            }
        }

        return $allFileTranslations;
    }

    /**
     * @return string
     */
    private function getTranslationsDirectory()
    {
        return __DIR__ . '/../../Resources/lang';
    }

    /**
     * @param string $relativePath
     * @return string
     */
    private function getLanguageFrom($relativePath)
    {
        return substr(strrchr($relativePath, "/"), 1);
    }

    /**
     * @param string $relativePath
     * @return string
     */
    private function getModuleFrom($relativePath)
    {
        return explode('/', $relativePath)[0];
    }

    private function getFileNameFrom($path)
    {
        $fileName = substr(strrchr($path, "/"), 1);

        return str_replace('.php', '', $fileName);
    }
}<commit_msg>Make it windows compatible!<commit_after><?php namespace Modules\Translation\Repositories\File;

use Illuminate\Filesystem\Filesystem;
use Modules\Translation\Repositories\FileTranslationRepository as FileTranslationRepositoryInterface;

class FileTranslationRepository implements FileTranslationRepositoryInterface
{
    /**
     * @var Filesystem
     */
    private $finder;

    public function __construct(Filesystem $finder)
    {
        $this->finder = $finder;
    }

    /**
     * Get all the translations for all modules on disk
     * @return array
     */
    public function all()
    {
        $allFileTranslations = [];
        $files = $this->finder->allFiles($this->getTranslationsDirectory());
        foreach ($files as $file) {
            $lang = $this->getLanguageFrom($file->getRelativePath());
            $path = $file->getRelativePathname();
            $contents = $this->finder->getRequire($this->getTranslationsDirectory() . '/' . $path);
            $trans = array_dot($contents, $this->getModuleFrom($file->getRelativePath()) . '::' . $this->getFileNameFrom($path) . '.');
            foreach ($trans as $key => $value) {
                $allFileTranslations[$lang][$key] = $value;
            }
        }

        return $allFileTranslations;
    }

    /**
     * @return string
     */
    private function getTranslationsDirectory()
    {
        return __DIR__ . '/../../Resources/lang';
    }

    /**
     * @param string $relativePath
     * @return string
     */
    private function getLanguageFrom($relativePath)
    {
        return substr(strrchr($relativePath, DIRECTORY_SEPARATOR), 1);
    }

    /**
     * @param string $relativePath
     * @return string
     */
    private function getModuleFrom($relativePath)
    {
        return explode(DIRECTORY_SEPARATOR, $relativePath)[0];
    }

    private function getFileNameFrom($path)
    {
        $fileName = substr(strrchr($path, DIRECTORY_SEPARATOR), 1);

        return str_replace('.php', '', $fileName);
    }
}
{'fraction_non_alphanumeric': 0.13638651233014595, 'fraction_numerical': 0.001509813789632612, 'mean_word_length': 2.552278820375335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5928466', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1089, 'n_words': 211}