@param string $checkPath

@return string
342382
private function getRootDir($checkPath)
    {
        $dir = $checkPath;
        while (!file_exists($dir . '/composer.json')) {
            if ($dir === dirname($dir)) {
                break;
            }
            $dir = dirname($dir);
        }

        return $dir;
    }
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; }
		}

	}
128924
protected function getFullPath($contextPath, $targetPath): string
    {
        if ($this->filesystem->isAbsolutePath($targetPath)) {
            return $targetPath;
        }

        return rtrim($contextPath, '/\\').DIRECTORY_SEPARATOR.$targetPath;
    }
65650
protected function getObjectName(string $savePath): string
    {
        $pathPrefix = $this->getPathPrefix();
        if ($pathPrefix != '') {
            return $pathPrefix . '/' . $savePath;
        }
        return $savePath;
    }
1333659
public function getChecks($file, $keepPath = false)
		{
			$checkfiles = array();
			$ext        = substr($file, strrpos($file, '.'));
			$path       = (true === $keepPath) ? dirname($file) . '/' : '';
			$filename   = basename($file, $ext);
			foreach ($this->_checks as $suffix) {
				$checkfiles[] = $path . $filename . $suffix . $ext;
			}
			return $checkfiles;
		}
593740
protected function safePath($path)
    {
        $path = str_replace('\\', '/', $path);
        $path = preg_replace('/(\.+\\/)/', './', $path);
        $path = preg_replace('/(\\/+)/', '/', $path);
        return $path;
    }
906192
protected function sanitizePath($path)
    {
        if (empty($path)) {
            return '';
        }

        $path = Files::getUnixStylePath($path);
        if (is_dir($path)) {
            $path = Files::getNormalizedPath($path);
        }

        return $path;
    }
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);
    }
1182221
private function splitPath($path)
    {
        // init
        $textDelimiter = '\'';
        $pathDelimiter = '.';
        $result = array();

        // action
        $stringIsOpen = false;
        $currentChunk = '';
        for ($i = 0; $i < strlen($path); $i++) {
            $currentSymbol = $path[$i];

            if ($currentSymbol == $textDelimiter) {
                $stringIsOpen = !$stringIsOpen;
            }

            if ($currentSymbol == $pathDelimiter && !$stringIsOpen) {
                $result[count($result)] = $currentChunk;
                $currentChunk = '';
                continue;
            }
            $currentChunk .= $currentSymbol;
        }

        $result[count($result)] = $currentChunk;

        // return
        return $result;
    }
909426
public function getResult($checkCode = true)
    {
        if (null === $this->result) {
            // for symfony/process:^4.2
            if (method_exists(Process::class, 'fromShellCommandline')) {
                $process = Process::fromShellCommandline($this->command, $this->cwd);
            } else {
                $process = new Process($this->command, $this->cwd);
            }
            $process->run();

            $this->result = new CliResult(
                $process->getExitCode(),
                $process->getOutput(),
                $process->getErrorOutput()
            );
        }

        if ($checkCode && 0 !== $this->result->getCode()) {
            throw new ExecutionException(
                $this->result,
                sprintf(
                    "Cannot execute `%s`:\nCode: %s\nExit text: %s\nError output: %s\nDetails:\n%s",
                    $this->command,
                    $this->result->getCode(),
                    isset(Process::$exitCodes[$this->result->getCode()]) ? Process::$exitCodes[$this->result->getCode()] : 'Unknown exit code',
                    $this->result->getError(),
                    $this->result->getOutput()
                ),
                $process->getExitCode()
            );
        }

        return $this->result;
    }
579621
public function getCheckerFromFQCN($checkerName)
    {
        $checkerName = trim($checkerName, '\\');
        if (!class_exists($checkerName)) {
            throw new \RuntimeException('Checker FQCN does not exists');
        }

        foreach ($this->checkers as $checker) {
            if ($checker instanceof $checkerName) {
                return $checker;
            }
        }

        throw new RuntimeException('Checker could not be found');
    }
151918
public function checked(bool $bool, string $checked = '&check;', string $unchecked = '-'): string
    {
        return $bool ? $checked : $unchecked;
    }
556893
public function getChecksumAlgorithm() : ?string
    {
        $checksumHeader = $this->getRequest()->header('Upload-Checksum');

        if (empty($checksumHeader)) {
            return self::DEFAULT_CHECKSUM_ALGORITHM;
        }

        list($checksumAlgorithm, /* $checksum */) = explode(' ', $checksumHeader);

        return $checksumAlgorithm;
    }
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;
    }
1148064
public static function res($relativePath)
    {
        $segments = explode("/", $_SERVER["SCRIPT_NAME"]);
        $phpFile = $segments[count($segments) - 1];

        return str_replace($phpFile, "", $_SERVER["SCRIPT_NAME"]) . $relativePath;
    }
219607
private function getRealFilePath( string $filePath ) : string
	{
		$realFilePath = getcwd() . DIRECTORY_SEPARATOR . ltrim( $filePath, '/' );
		$outputDir    = dirname( $realFilePath );
		if ( !@mkdir( $outputDir, 0777, true ) && !is_dir( $outputDir ) )
		{
			throw new InvalidArgumentException( 'Invalid file path: ' . $realFilePath );
		}

		return $realFilePath;
	}
1207500
protected static function overlayPath($path)
    {
        $path = str_replace('\\', '/', $path);
        $hasOverlay = false;
        if (strpos($path, self::$rootPath) !== 0) {
            // Path is not below root path, ignore it
            return $path;
        }

        $newPath = ltrim(substr($path, strlen(self::$rootPath)), '/');
        foreach (self::$overlayPaths as $overlay => $replace) {
            if (strpos($newPath, $overlay) === 0) {
                $newPath = $replace . substr($newPath, strlen($overlay));
                $hasOverlay = true;
                break;
            }
        }
        return $hasOverlay ? $newPath : $path;
    }