public function sendHeaders()
    {
        if (!$this->headersAreSent()) {
            header(
                sprintf(
                    'HTTP/%s %s %s',
                    $this->httpVersion,
                    $this->statusCode,
                    $this->statusText
                ),
                true,
                $this->statusCode
            );

            // Send the headers
            foreach ($this->headers->getAll() as $name => $values) {
                // Headers are allowed to have multiple values
                foreach ($values as $value) {
                    header("$name:$value", false, $this->statusCode);
                }
            }

            // Send the cookies
            /** @var Cookie $cookie */
            foreach ($this->headers->getCookies(true) as $cookie) {
                setcookie(
                    $cookie->getName(),
                    $cookie->getValue(),
                    $cookie->getExpiration(),
                    $cookie->getPath(),
                    $cookie->getDomain(),
                    $cookie->isSecure(),
                    $cookie->isHttpOnly()
                );
            }
        }
    }
public function sendHeaders()
    {
        if (!$this->headersAreSent()) {
            header(
                sprintf(
                    'HTTP/%s %s %s',
                    $this->httpVersion,
                    $this->statusCode,
                    $this->statusText
                ),
                true,
                $this->statusCode
            );

            // Send the headers
            foreach ($this->headers->getAll() as $name => $values) {
                // Headers are allowed to have multiple values
                foreach ($values as $value) {
                    header("$name:$value", false, $this->statusCode);
                }
            }

            // Send the cookies
            /** @var Cookie $cookie */
            foreach ($this->headers->getCookies(true) as $cookie) {
                setcookie(
                    $cookie->getName(),
                    $cookie->getValue(),
                    $cookie->getExpiration(),
                    $cookie->getPath(),
                    $cookie->getDomain(),
                    $cookie->isSecure(),
                    $cookie->isHttpOnly()
                );
            }
        }
    }
public function sendHeaders ( ) { if ( ! $ this -> headersAreSent ( ) ) { header ( sprintf ( 'HTTP/%s %s %s' , $ this -> httpVersion , $ this -> statusCode , $ this -> statusText ) , true , $ this -> statusCode ) ; // Send the headers foreach ( $ this -> headers -> getAll ( ) as $ name => $ values ) { // Headers are allowed to have multiple values foreach ( $ values as $ value ) { header ( "$name:$value" , false , $ this -> statusCode ) ; } } // Send the cookies /** @var Cookie $cookie */ foreach ( $ this -> headers -> getCookies ( true ) as $ cookie ) { setcookie ( $ cookie -> getName ( ) , $ cookie -> getValue ( ) , $ cookie -> getExpiration ( ) , $ cookie -> getPath ( ) , $ cookie -> getDomain ( ) , $ cookie -> isSecure ( ) , $ cookie -> isHttpOnly ( ) ) ; } } }
Sends the headers if they haven't already been sent
Sends the headers if they haven t already been sent