@param string $filePath

@return LangFileAbstract
775291
public function setFilePath( $filePath )
	{
		$this->filePath      = $filePath;
		$this->shortFilePath = str_replace( base_path() , '' , $filePath );

		return $this;
	}
139359
protected function backupFile($filePath)
    {
        $sourcePath = $filePath;
        $backupPath = $filePath.'.bak';

        if (file_exists($backupPath)) {
            $date = new \DateTime();
            $backupPath = "{$filePath}{$date->getTimestamp()}.bak";
        }

        copy($sourcePath, $backupPath);

        return $backupPath;
    }
619165
public static function parse(string $filePath): FilePathInterface
    {
        if (!self::myFilePathParse(
            DIRECTORY_SEPARATOR,
            $filePath,
            function ($p, $d, &$e) {
                return self::myPartValidator($p, $d, $e);
            },
            null,
            $isAbsolute,
            $aboveBaseLevel,
            $drive,
            $directoryParts,
            $filename,
            $error)
        ) {
            throw new FilePathInvalidArgumentException('File path "' . $filePath . '" is invalid: ' . $error);
        }

        return new self($isAbsolute, $aboveBaseLevel, $drive, $directoryParts, $filename);
    }
1043111
public function extract($filePath)
    {
        $directory = $this->directory->getDirectoryPath();
        $pharArchive = new PharData($filePath, null, null, Phar::GZ);
        $pharArchive->extractTo($directory);

        return $this->createFinderFromDirectory($directory);
    }
429196
public function setFilePath($filePath)
    {
        Assert::stringNotEmpty($filePath, 'The factory file path must be a non-empty string. Got: %s');

        $this->setDirectory(Path::getDirectory($filePath));
        $this->setFileName(Path::getFilename($filePath));

        return $this;
    }
465928
public function setFilepath($filepath)
    {
        $this->_path = pathinfo($filepath);

        if (!isset($this->_path['extension']))
            $this->_path['extension'] = null;

        return $this;
    }
176073
public function getFileContent( string$filePath ):string
	{
		return isset($this->fileGetter) ? $this->fileGetter($filePath) : file_get_contents($filePath);
	}
61225
private function getSharedStimulusFile($filePath)
    {
        \helpers_TimeOutHelper::setTimeOutLimit(\helpers_TimeOutHelper::LONG);
        $extractPath = $this->extractArchive($filePath);
        \helpers_TimeOutHelper::reset();

        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($extractPath),
            \RecursiveIteratorIterator::LEAVES_ONLY);

        /** @var $file \SplFileInfo */
        foreach ($iterator as $file) {
            //check each file to see if it can be the shared stimulus file
            if ($file->isFile()) {
                if (preg_match('/^[\w]/', $file->getFilename()) === 1 && $file->getExtension() === 'xml') {
                    return $file->getRealPath();
                }
            }
        }

        throw new \common_Exception('XML not found in the package');
    }
704981
protected function importFile($filePath, $fileName = null)
    {
        // Filename parsing
        if ($fileName == null) {
            $fileName = basename($filePath);
        }
        if (!preg_match('/\w+\.\w+\.\w+/', $fileName)) {
            throw new ImportException("Invalid filename [$fileName], all translation files must be named: domain.locale.format (ex: messages.en.yml)");
        }
        list($domain, $locale, $format) = explode('.', $fileName, 3);
        $catalogue = $this->translator->loadResource(array(
            'format' => $format,
            'locale' => $locale,
            'domain' => $domain,
            'path' => $filePath,
        ));

        // Merge with existing entries
        $translations = $this->getTranslationsFromSession();
        $counters = array('new' => 0, 'updated' => 0);
        if (!array_key_exists($locale, $translations)) {
            $translations[$locale] = array('new' => array(), 'updated' => array());
        }
        foreach ($catalogue->all() as $domain => $messages) {
            foreach ($messages as $key => $value) {
                if ($trans = $this->repository->findTranslation($domain, $key, $locale, true)) {
                    if ($trans->getValue() !== $value) {
                        $translations[$locale]['updated'][$domain][$key] = array('old' => $trans->getValue(), 'new' => $value);
                        $counters['updated'] += 1;
                    }
                } else {
                    $translations[$locale]['new'][$domain][$key] = $value;
                    $counters['new'] += 1;
                }
            }
        }

        $this->updateSession($translations);

        return $counters;
    }
993401
public function setFile($filePath)
    {
        if (is_file($filePath)) {
            $this->file = new SplFileInfo($filePath);

            if (file_exists(
                $propertiesFilePath = $this->file->getPath() . DIRECTORY_SEPARATOR . str_replace(
                        '.phtml',
                        '.json',
                        strtolower($this->file->getBasename())
                    )
            )) {
                $properties = file_get_contents($propertiesFilePath);
                $properties = json_decode($properties, true);

                if (isset($properties[ 'vars' ])) {
                    $this->vars = $properties[ 'vars' ];
                }

                if (isset($properties[ 'presets' ])) {
                    $this->presets = new SplArrayObject($properties[ 'presets' ]);
                }
            }
        }

        return $this;
    }
791385
public function setLogFile($filePath)
    {
        if ($this->logFile != $filePath && $this->fp) {
            @fclose($this->fp);
            $this->fp = null;
        }
        $logDir = dirname($filePath);
        if (!file_exists($logDir)) {
            @mkdir($logDir, 0755, true);
        }

        if (!file_exists($logDir)) {
            throw new Exception(sprintf('Can\'t create log directory "%s".', $logDir), 'logger');
        }

        if (!$this->fp = @fopen($filePath, 'a+')) {
            throw new Exception(sprintf('Can\'t create log file "%s".', $filePath), 'logger');
        }

        $this->logFile = $filePath;
        return $this;
    }
114064
private static function parseFile($filePath = '')
    {
        $supportFileType = array();
        $supportFileType = array_merge($supportFileType, self::supportFilePHP());
        $supportFileType = array_merge($supportFileType, self::supportFileYAML());
        foreach ($supportFileType as $value) {
            $file = sprintf('%s.%s', $filePath, $value);
            if (is_file($file)) {
                if (in_array($value, self::supportFilePHP())) {
                    return require($file);
                }
                if (in_array($value, self::supportFileYAML())) {
                    return Yaml::parse(file_get_contents($file));
                }
            }
        }
        return null;
    }
734592
public static function createEmptyByFilePath(string $filepath) : Repository
    {
        $filename = basename($filepath);
        list($domain, $language, $extension) = explode('.', $filename, 3);

        return new self(
            TranslationCollection::create([]),
            $filepath,
            $language,
            $domain
        );
    }
1119709
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
        );
    }
209641
private function LanguageCsvFile($basePath)
    {
        $ext = IO\Path::Extension($basePath);
        $baseFile = IO\Path::RemoveExtension($basePath);
        $langFile = IO\Path::AddExtension($baseFile, $this->language);
        return IO\Path::AddExtension($langFile, $ext);
    }
826324
public function getPath(string $filePath): PathTransfer
    {
        $rootPath = $this->getRootApplicationDirectoryPathByFilePath($filePath);
        $corePath = $this->getCorePath($filePath);
        $projectPath = $this->getProjectPath($filePath);

        $pathTransfer = new PathTransfer();

        $pathTransfer->setRootPath($rootPath);
        $pathTransfer->setCorePath($corePath);
        $pathTransfer->setProjectPath($projectPath);

        return $pathTransfer;
    }
39418
public function readFile($filePath)
    {
        try {
            $file = fopen($filePath, 'r');
            $content = fread($file, filesize($filePath));
            fclose($file);
            return $content;
        } catch (\Exception $e) {
            return '';
        }
    }