private static function convertFileToClass(string $file)
    {
        $fh = fopen($file, 'r');

        $namespace = '';

        while(($line = fgets($fh, 5000)) !== false) {

            if (str_contains($line, 'namespace')) {
                $namespace = trim(str_replace(['namespace', ';'], '', $line));
                break;
            }
        }

        fclose($fh);

        $class = basename(str_replace('.php', '', $file));

        return $namespace.'\\'.$class;
    }
private static function convertFileToClass(string $file)
    {
        $fh = fopen($file, 'r');

        $namespace = '';

        while(($line = fgets($fh, 5000)) !== false) {

            if (str_contains($line, 'namespace')) {
                $namespace = trim(str_replace(['namespace', ';'], '', $line));
                break;
            }
        }

        fclose($fh);

        $class = basename(str_replace('.php', '', $file));

        return $namespace.'\\'.$class;
    }
private static function convertFileToClass ( string $ file ) { $ fh = fopen ( $ file , 'r' ) ; $ namespace = '' ; while ( ( $ line = fgets ( $ fh , 5000 ) ) !== false ) { if ( str_contains ( $ line , 'namespace' ) ) { $ namespace = trim ( str_replace ( [ 'namespace' , ';' ] , '' , $ line ) ) ; break ; } } fclose ( $ fh ) ; $ class = basename ( str_replace ( '.php' , '' , $ file ) ) ; return $ namespace . '\\' . $ class ; }
Converts a file name to a namespaced class name.

@param string $file
@return string
Converts a file name to a namespaced class name .