protected function withHeaderLogic($name, $value, $add)
    {
        $this->assertHeaderName($name);
        $this->assertHeaderValue($value);
        $this->assertHeadersNotSent();
        
        foreach ((array)$value as $val) {
            $this->header("{$name}: {$val}", !$add);
        }
        
        return $this;
    }