src/FileSystem/DirHandler.php
private function _findFile(string $dirName, string $fileName): ?FileHandler {
        $dirs = glob($dirName . '*');
        $file = null;
        foreach ($dirs as $d) {
            if (is_file($d)) {
                $pathInfo = \pathinfo($d);
                $pathInfo2 = \pathinfo($fileName);

                if (isset($pathInfo2["extension"])) {
                    $condition = $pathInfo["basename"] === $pathInfo2["basename"];
                } else {
                    $condition = $pathInfo["filename"] === $pathInfo2["filename"];
                }

                if ($condition) {
                    return new FileHandler($dirName . "/" . $pathInfo["basename"]);
                }
            } else if (is_dir($d)) {
                $tmp = $this->_findFile($d . "/", $fileName);
                if (null !== $tmp) {
                    $file = $tmp;
                }
            }
        }
        return $file;
    }
private function _findFile(string $dirName, string $fileName): ?FileHandler {
        $dirs = glob($dirName . '*');
        $file = null;
        foreach ($dirs as $d) {
            if (is_file($d)) {
                $pathInfo = \pathinfo($d);
                $pathInfo2 = \pathinfo($fileName);

                if (isset($pathInfo2["extension"])) {
                    $condition = $pathInfo["basename"] === $pathInfo2["basename"];
                } else {
                    $condition = $pathInfo["filename"] === $pathInfo2["filename"];
                }

                if ($condition) {
                    return new FileHandler($dirName . "/" . $pathInfo["basename"]);
                }
            } else if (is_dir($d)) {
                $tmp = $this->_findFile($d . "/", $fileName);
                if (null !== $tmp) {
                    $file = $tmp;
                }
            }
        }
        return $file;
    }
private function _findFile ( string $ dirName , string $ fileName ) : ? FileHandler { $ dirs = glob ( $ dirName . '*' ) ; $ file = null ; foreach ( $ dirs as $ d ) { if ( is_file ( $ d ) ) { $ pathInfo = \ pathinfo ( $ d ) ; $ pathInfo2 = \ pathinfo ( $ fileName ) ; if ( isset ( $ pathInfo2 [ "extension" ] ) ) { $ condition = $ pathInfo [ "basename" ] === $ pathInfo2 [ "basename" ] ; } else { $ condition = $ pathInfo [ "filename" ] === $ pathInfo2 [ "filename" ] ; } if ( $ condition ) { return new FileHandler ( $ dirName . "/" . $ pathInfo [ "basename" ] ) ; } } else if ( is_dir ( $ d ) ) { $ tmp = $ this -> _findFile ( $ d . "/" , $ fileName ) ; if ( null !== $ tmp ) { $ file = $ tmp ; } } } return $ file ; }
finds a file in the given dir

@param $dirName
@param $fileName
@return string
finds a file in the given dir