classes/bfw/Response.php
author Markus Bröker <broeker.markus@googlemail.com>
Thu, 12 Nov 2015 14:39:16 +0100
changeset 0 4869aea77e21
child 1 56e0dbd5c243
permissions -rw-r--r--
Bröker-Framework BFW-1

<?php

namespace bfw {
    /**
     * Response Headers sind kompliziert
     *
     */
    class Response {
        private $headers;
        private $statusCode;

        public function __construct() {
            $this->headers = headers_list();
            $this->statusCode = http_response_code();
        }

        public function getHeaders() {
            return $this->headers;
        }

        public function setStatusCode($statusCode) {
            $this->statusCode = $statusCode;

            return $this;
        }

        public function getStatusCode() {
            return $this->statusCode;
        }

        /**
         * @return string
         */
        public function get($key) {
            if (array_key_exists($key, $this->headers)) {
                return $this->headers[$key];
            }

            return '';
        }

    }
}