Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
CRAP
75.00% covered (warning)
75.00%
3 / 4
RedirectResponse
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
3.14
75.00% covered (warning)
75.00%
3 / 4
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 get
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 send
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
declare(strict_types=1);
namespace Eywa\Http\Response {
    use Eywa\Exception\Kedavra;
    class RedirectResponse
    {
        /**
         *
         * The redirect response
         *
         */
        private Response $response;
        /**
         *
         * RedirectResponse constructor.
         *
         * @param string $url
         * @param int $status
         *
         * @throws Kedavra
         */
        public function __construct(string $url, int $status = 301)
        {
            $this->response = new Response('', $url, $status, ['Location' => $url]);
        }
        /**
         *
         * Get the response
         *
         * @return Response
         *
         */
        public function get(): Response
        {
            return $this->response;
        }
        /**
         *
         * Send the response
         *
         * @return Response
         *
         */
        public function send(): Response
        {
            return $this->response->send();
        }
    }
}