public static function classInfo($file)
    {
        if (is_file($file)) {
            $phpCode = file_get_contents($file);
        } else {
            $phpCode = $file;
        }
        
        $namespace = false;
        
        if (preg_match('/^namespace\s+(.+?);(\s+|\r\n)?$/sm', $phpCode, $results)) {
            $namespace = $results[1];
        }
        
        $classes = self::classNameByTokens($phpCode);
        
        return ['namespace' => $namespace, 'class' => end($classes)];
    }
public static function classInfo($file)
    {
        if (is_file($file)) {
            $phpCode = file_get_contents($file);
        } else {
            $phpCode = $file;
        }
        
        $namespace = false;
        
        if (preg_match('/^namespace\s+(.+?);(\s+|\r\n)?$/sm', $phpCode, $results)) {
            $namespace = $results[1];
        }
        
        $classes = self::classNameByTokens($phpCode);
        
        return ['namespace' => $namespace, 'class' => end($classes)];
    }
public static function classInfo ( $ file ) { if ( is_file ( $ file ) ) { $ phpCode = file_get_contents ( $ file ) ; } else { $ phpCode = $ file ; } $ namespace = false ; if ( preg_match ( '/^namespace\s+(.+?);(\s+|\r\n)?$/sm' , $ phpCode , $ results ) ) { $ namespace = $ results [ 1 ] ; } $ classes = self :: classNameByTokens ( $ phpCode ) ; return [ 'namespace' => $ namespace , 'class' => end ( $ classes ) ] ; }
Provide class informations from a file path or file content.

This is used when working with file paths from composer, in order to detect class and namespace from a given file.

@param string $file The file path to the class into order to get infos from, could also be the content directly from a given file.
@return array If the given filepath is a file, it will return an array with the keys:
+ namespace: the namespace of the file, if false no namespace could have been determined.
+ class: the class name of the file, if false no class could have been determined.
Provide class informations from a file path or file content .