IMO, there is duplication code here. You should use something like:

``` php
if (is_int($key)) {
    list ($key, $value) = $this->extractHeaderKeyAndValue($value);
}
    
$rationalizedHeaders[$key] = trim($value);
```