public function add(string $class, string $filename): self
    {
        if (substr($class, -2) === '\*') { // Is class in a namespace. Example: Namespace\*
            $this->patterns[] = [substr($class, 0, -1), $filename];
        } else {
            $this->classes[$class] = $filename;
        }
        return $this;
    }
public function add(string $class, string $filename): self
    {
        if (substr($class, -2) === '\*') { // Is class in a namespace. Example: Namespace\*
            $this->patterns[] = [substr($class, 0, -1), $filename];
        } else {
            $this->classes[$class] = $filename;
        }
        return $this;
    }
public function add ( string $ class , string $ filename ) : self { if ( substr ( $ class , - 2 ) === '\*' ) { // Is class in a namespace. Example: Namespace\* $ this -> patterns [ ] = [ substr ( $ class , 0 , - 1 ) , $ filename ] ; } else { $ this -> classes [ $ class ] = $ filename ; } return $ this ; }
Registers a class for autoloading.

@param string $class The class name or class name pattern (format: Namespace\*).
@param string $filename The filename that contains the class or path pattern (format: path/to/file/*.php).
@return self Returns a reference to itself.
Registers a class for autoloading .