<commit_before><?php

namespace Fracture\Http;

class ContentTypeHeader implements AbstractedHeader
{


    private $headerValue = '';

    private $item = [];


    public function __construct($headerValue = '')
    {
        $this->headerValue = $headerValue;
    }


    public function setAlternativeValue($headerValue)
    {
        $this->headerValue = $headerValue;
    }


    public function prepare()
    {
        $this->item = [];

        if (strlen($this->headerValue) > 0) {
            $this->item = $this->extractData($this->headerValue);
        }
    }


    public function extractData($headerValue)
    {
        $result = [];
        $parts = preg_split('#;\s?#', $headerValue, -1, \PREG_SPLIT_NO_EMPTY);

        if (count($parts) === 0) {
            return [];
        }

        $result['value'] = array_shift($parts);

        foreach ($parts as $item) {
            list($key, $value) = explode('=', $item . '=');
            $result[ $key ] = $value;
        }

        return $result;
    }

    public function contains($type)
    {
        return array_key_exists('value', $this->item) && $this->item['value'] === $type;
    }
}<commit_msg>cleanup for ontent type header<commit_after><?php

namespace Fracture\Http;

class ContentTypeHeader implements AbstractedHeader
{

    private $headerValue = '';

    private $item = [];


    /**
     * @param string $headerValue
     */
    public function __construct($headerValue = '')
    {
        $this->headerValue = $headerValue;
    }


    /**
     * @param string $headerValue
     */
    public function setAlternativeValue($headerValue = '')
    {
        $this->headerValue = $headerValue;
    }


    public function prepare()
    {
        $this->item = [];

        if (strlen($this->headerValue) > 0) {
            $this->item = $this->extractData($this->headerValue);
        }
    }


    /**
     * @param string $headerValue
     * @return array
     */
    public function extractData($headerValue)
    {
        $result = [];
        $parts = preg_split('#;\s?#', $headerValue, -1, \PREG_SPLIT_NO_EMPTY);

        if (count($parts) === 0) {
            return [];
        }

        $result['value'] = array_shift($parts);

        foreach ($parts as $item) {
            list($key, $value) = explode('=', $item . '=');
            $result[ $key ] = $value;
        }

        return $result;
    }


    /**
     * @param string $type
     * @return bool
     */
    public function contains($type)
    {
        return array_key_exists('value', $this->item) && $this->item['value'] === $type;
    }
}
{'fraction_non_alphanumeric': 0.16038461538461538, 'fraction_numerical': 0.002307692307692308, 'mean_word_length': 2.0636042402826855, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '5550020', 'n_tokens_mistral': 804, 'n_tokens_neox': 768, 'n_words': 152}