<commit_before><?php
namespace Headzoo\Web\Tools\Parsers;
use Headzoo\Web\Tools\HttpMethods;

/**
 * Parses request/response headers into an array.
 */
class Headers
    implements HeadersInterface
{
    /**
     * {@inheritDoc}
     */
    public function parse($headers, &$options = null)
    {
        $methods = HttpMethods::getValues();
        $methods = join("|", $methods);
        $regex   = "~^({$methods})\\b~i";
        
        $parsed  = [];
        $lines = preg_split("/\\R/", $headers);
        foreach($lines as $line) {
            if (preg_match($regex, $line)) {
                $options = $line;
            } else if (preg_match("~^HTTP/~", $line)) {
                $options = $line;
            } else if (!empty($line)) {
                list($name, $value) = preg_split("/:\\S*/", $line, 2);
                $name  = str_replace("-", " ", $name);
                $name  = ucwords(strtolower($name));
                $name  = str_replace(" ", "-", $name);
                $value = trim($value);
                $parsed[$name] = $value;
            }
        }
        
        return $parsed;
    }
} <commit_msg>phpdoc update<commit_after><?php
namespace Headzoo\Web\Tools\Parsers;
use Headzoo\Web\Tools\HttpMethods;

/**
 * Parses raw request/response headers into an array.
 */
class Headers
    implements HeadersInterface
{
    /**
     * {@inheritDoc}
     */
    public function parse($headers, &$options = null)
    {
        $methods = HttpMethods::getValues();
        $methods = join("|", $methods);
        $regex   = "~^({$methods})\\b~i";
        
        $parsed  = [];
        $lines = preg_split("/\\R/", $headers);
        foreach($lines as $line) {
            if (preg_match($regex, $line)) {
                $options = $line;
            } else if (preg_match("~^HTTP/~", $line)) {
                $options = $line;
            } else if (!empty($line)) {
                list($name, $value) = preg_split("/:\\S*/", $line, 2);
                $name  = str_replace("-", " ", $name);
                $name  = ucwords(strtolower($name));
                $name  = str_replace(" ", "-", $name);
                $value = trim($value);
                $parsed[$name] = $value;
            }
        }
        
        return $parsed;
    }
} 
{'fraction_non_alphanumeric': 0.1796669588080631, 'fraction_numerical': 0.0008764241893076249, 'mean_word_length': 1.6639439906651108, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4320548', 'n_tokens_mistral': 711, 'n_tokens_neox': 694, 'n_words': 138}