src/Core/Support/WordPressFileHeaders.php
public function headers(string $path, array $headers): array
    {
        $data = $this->read($path);
        $properties = [];

        foreach ($headers as $field => $regex) {
            if (preg_match('/^[ \t\/*#@]*'.preg_quote($regex, '/').':(.*)$/mi', $data, $match) && $match[1]) {
                $properties[$field] = trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $match[1]));
            } else {
                $properties[$field] = '';
            }
        }

        return $properties;
    }
public function headers(string $path, array $headers): array
    {
        $data = $this->read($path);
        $properties = [];

        foreach ($headers as $field => $regex) {
            if (preg_match('/^[ \t\/*#@]*'.preg_quote($regex, '/').':(.*)$/mi', $data, $match) && $match[1]) {
                $properties[$field] = trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $match[1]));
            } else {
                $properties[$field] = '';
            }
        }

        return $properties;
    }
public function headers ( string $ path , array $ headers ) : array { $ data = $ this -> read ( $ path ) ; $ properties = [ ] ; foreach ( $ headers as $ field => $ regex ) { if ( preg_match ( '/^[ \t\/*#@]*' . preg_quote ( $ regex , '/' ) . ':(.*)$/mi' , $ data , $ match ) && $ match [ 1 ] ) { $ properties [ $ field ] = trim ( preg_replace ( "/\s*(?:\*\/|\?>).*/" , '' , $ match [ 1 ] ) ) ; } else { $ properties [ $ field ] = '' ; } } return $ properties ; }
Return the file headers as an associative array.

@param string $path
@param array  $headers

@return array
Return the file headers as an associative array .