Returns the binary content of $filePath from DFS

@param string $filePath local file path
@return binary|bool file's content, or false
@todo Handle errors using exceptions
341527
public function getContents( $filePath )
    {
        $this->accumulatorStart();

        // @todo Throw an exception if it fails
        //       (FileNotFound, or FileNotReadable, depends on testing)
        $ret = @file_get_contents( $this->makeDFSPath( $filePath ) );

        $this->accumulatorStop();

        return $ret;
    }
610026
private function extractFileNameBase($filePath)
    {
        $directories = explode('/', $filePath);
        $fileName = array_pop($directories);
        $fileNameParts = explode('.', $fileName);
        if (count($fileNameParts) > 1) {
            $extension = array_pop($fileNameParts);
        }
        $result = implode('.', $fileNameParts);
        return $result;
    }
176076
protected function isAbsolutePath($filePath)
    {
        if ($filePath === null || $filePath === '') {
            return false;
        }
    
        if ($filePath[0] === DIRECTORY_SEPARATOR || preg_match('~\A[A-Z]:(?![^/\\\\])~i', $filePath) > 0) {
            return true;
        }
    
        return false;
    }
1166392
public function loadFile($filePath)
    {
        if ($filePath instanceof \SplFileInfo) {
            $filePath = $filePath->getRealPath();
        }

        if (isset($this->sourceFileDirectory)) {
            if (is_file($this->sourceFileDirectory . $filePath)) {
                $filePath = $this->sourceFileDirectory . $filePath;
            }
        }

        if (is_file($filePath)) {
            $this->sourceFilePath = realpath($filePath);
            $this->sourceFileDirectory = pathinfo($this->sourceFilePath, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR;

            return $this->loadString(file_get_contents($filePath));
        }

        return false;
    }
268399
protected function convertToUseRealPath($filePath)
    {
        $realFilePath = $filePath;

        if ($this->isZipStream($filePath)) {
            if (preg_match('/zip:\/\/(.*)#(.*)/', $filePath, $matches)) {
                $documentPath = $matches[1];
                $documentInsideZipPath = $matches[2];
                $realFilePath = 'zip://' . realpath($documentPath) . '#' . $documentInsideZipPath;
            }
        } else {
            $realFilePath = realpath($filePath);
        }

        return $realFilePath;
    }
1332275
public function readFile($filePath)
    {
        if (false === $fileContent = @file_get_contents($filePath)) {
            throw new RuntimeException(
                sprintf('unable to read file "%s"', $filePath)
            );
        }

        return $fileContent;
    }
659337
public function loadFile($filePath)
    {
        if ($filePath instanceof \SplFileInfo) {
            $filePath = $filePath->getRealPath();
        }

        if (is_file($filePath)) {
            return $this->loadString(file_get_contents($filePath));
        }

        return false;
    }
1315587
protected function initHandle($filePath)
    {
        if ($this->hasHandle()) {
            rewind($this->handle);

            return $this->handle;
        }

        $this->handle = $this->createHandle($filePath);

        return $this->handle;
    }
445875
public function getExtensionByFileName($filepath)
    {
        $path = pathinfo($filepath);

        // check if the file has the extenison and we need
        // to lower down the extension (caused unknown extension for uppercased extension)
        if (isset($path['extension'])) {
            return strtolower($path['extension']);
        } else if (is_string($this->getMime())) {
            return str_replace("image/", "", $this->getMime());
        } else if ($this->format != "") {
            return $this->format;
        } else {
            // fallback to enable save image on empty extension. ImageMagick has no problem with this.
            return "jpg";
        }
    }
753188
public function getFilePath( string$filePath, string$path=null ):string
	{
		if( !isset($this->basePath) )
			{ throw new \Exception('BasePath musbe set.'); }

		if( !strlen($filePath) )
			{ throw new \Exception('FilePath cannot be empty.'); }

		if( '/'===$filePath{0} ){
			if( is_null($path) )
				{ return $filePath; }
			else
				{ return $this->basePath.$filePath; }
		}else{
			if( !strlen($path) )
				{ return $this->basePath.'/'.$filePath; }
			elseif( '/'===substr($path,-1) )
				{ return $path.$filePath; }
			else
				{ return $path.'/'.$filePath; }
		}

	}
629520
public function getCurrentPermission($filePath)
    {
        if (!file_exists($filePath)) {
            return false;
        }

        $fileInfo= stat($filePath);

        return substr(base_convert($fileInfo['mode'],10,8), -4);
    }
421556
private static function setHash($filePath)
    {
        if (stristr(php_uname('s'), 'WIN')) {
            $filePath = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $filePath);
        }

        return md5($filePath);
    }
251681
public function fileIsReadable($filePath)
    {
        $filePath = realpath($filePath);

        // Return the cache, if we have any.
        if (isset(static::$isReadableCache[$filePath]) === true) {
            return static::$isReadableCache[$filePath];
        }

        // Set the cache and return it.
        return static::$isReadableCache[$filePath] = is_readable($filePath) && is_file($filePath);
    }
208160
public static function getXmlContent($filePath)
    {
        $useErrors = libxml_use_internal_errors(true);
        $content = simplexml_load_file($filePath);
        if (false === $content) {
            $error = libxml_get_last_error();
            throw new \Exception(sprintf("%s in %s", $error->message, $error->file));
        }

        libxml_clear_errors();
        libxml_use_internal_errors($useErrors);

        return $content;
    }
756515
public function findFile($filePath)
    {
        if (file_exists($filePath)) {
            return $filePath;
        }
        foreach ($this->supportedExtensions as $extension)
        {
            $extendedFilePath = $filePath.'.'.$extension;
            if (file_exists($extendedFilePath)) {
                return $extendedFilePath;
            }
            $extendedFilePath = $filePath.'.'.strtoupper($extension);
            if (file_exists($extendedFilePath)) {
                return $extendedFilePath;
            }
            $extendedFilePath = $filePath.'.'.ucfirst($extension);
            if (file_exists($extendedFilePath)) {
                return $extendedFilePath;
            }
        }
        return null;
    }
436104
protected function normalizePath($filePath)
    {
        if (($path = \Yii::getPathOfAlias($filePath)) !== false) {
            $filePath = $path;
        }

        return $filePath;
    }
1002137
private function getTranslationsInFile($filePath)
    {
        
	 	// File extension ?
        $extOk = in_array(\Jig\Utils\FsUtils::getFileExtension($filePath), $this->getFileTypes());

        if ($extOk){
            foreach ($this->getBannedFileType() as $bannedExt){
                $extOk &= substr_compare($filePath, $bannedExt, strlen($filePath)-strlen($bannedExt), strlen($bannedExt)) !== 0;
            }
        }

        if ($extOk) {
            
		 	// We read the file.
		 	$lines = file($filePath);
		 	foreach ($lines as $line) {
                $strings = $this->getTranslationPhrases( $line );
                //preg_match_all("/__(\(| )+['\"](.*?)['\"](\))?/u", $line, $string);
                
                //lookup for __('to translate') or __ 'to translate'
            //    preg_match_all("/__(\(| )+(('(.*?)')|(\"(.*?)\"))(\))?/u", $line, $string);
            
                foreach($strings as $s) {
                    $tu = new tao_helpers_translation_TranslationUnit();
                    $tu->setSource(tao_helpers_translation_POUtils::sanitize($s));
                    $tus = $this->getTranslationUnits();
                    $found = false;
                    
                    // We must add the string as a new TranslationUnit only
                    // if a similiar source does not exist.
                    foreach ($tus as $t) {
                        if ($tu->getSource() == $t->getSource()) {
                            $found = true;
                            break;
                        }
                    }
                    
                    if (!$found) {
                        $tus[] = $tu;
                        $this->setTranslationUnits($tus);
                    }
                }
		 	}
		}
        
    }