protected function getHeaderFromFile(string $pathAndFilename): string
    {
        $header = '';
        $fileHandle = fopen($pathAndFilename, 'r');
        while ($line = fgets($fileHandle)) {
            if (preg_match('/^#/', $line)) {
                $header .= $line;
            } else {
                break;
            }
        }
        fclose($fileHandle);
        return $header;
    }
protected function getHeaderFromFile(string $pathAndFilename): string
    {
        $header = '';
        $fileHandle = fopen($pathAndFilename, 'r');
        while ($line = fgets($fileHandle)) {
            if (preg_match('/^#/', $line)) {
                $header .= $line;
            } else {
                break;
            }
        }
        fclose($fileHandle);
        return $header;
    }
protected function getHeaderFromFile ( string $ pathAndFilename ) : string { $ header = '' ; $ fileHandle = fopen ( $ pathAndFilename , 'r' ) ; while ( $ line = fgets ( $ fileHandle ) ) { if ( preg_match ( '/^#/' , $ line ) ) { $ header .= $ line ; } else { break ; } } fclose ( $ fileHandle ) ; return $ header ; }
Read the header part from the given file. That means, every line
until the first non comment line is found.

@param string $pathAndFilename
@return string The header of the given YAML file
Read the header part from the given file . That means every line until the first non comment line is found .