Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 16
Header
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
 __construct($name, $value, $replace = true)
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
Headers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 4
42
0.00% covered (danger)
0.00%
0 / 12
 set($headerName, $headerValue, $replace = true)
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setMultiple($headerArray)
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 4
 setHttp($header)
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 send()
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 5
<?php
/**
 *
 */
namespace aae\dispatch {
    /**
     * @author Axel Ancona Esselmann
     * @package aae\dispatch
     */
    class Header {
        public $name, $value, $replace;
        public function __construct($name, $value, $replace = true) {
            $this->name    = $name;
            $this->value   = $value;
            $this->replace = $replace;
        }
    }
    class Headers {
        private $_headers = [];
        public function set($headerName, $headerValue, $replace = true) {
            $this->_headers[] = new Header($headerName, $headerValue, $replace);
        }
        public function setMultiple($headerArray) {
            foreach ($headerArray as $headerName => $value) {
                $this->set($headerName, $value);
            }
        }
        public function setHttp($header) {
            throw new \Exception("not implemented!", 1);
        }
        public function send() {
            foreach ($this->_headers as $header) {
                $headerString = $header->name.": ".$header->value;
                header($headerString, $header->replace);
            }
        }
    }
}