mosbth / Anax-MVC

Anax as a PHP based and MVC inspired framwork
MIT License
8 stars 31 forks source link

Enhance CResponse::redirect() to use an url created by the framework #22

Closed mosbth closed 8 years ago

mosbth commented 8 years ago

Current implementation expects an url created by the framework. Otherwise the header will redirect to a "wrong" url.

    public function redirect($url)
    {
        $this->checkIfHeadersAlreadySent();
        header('Location: ' . $url);
        exit();
    }

It would be easier, if the method itself called url->create() to create the proper url. This means that CResponse is to be dependent on $di. But waving pros and cons I feel that its a more usable way to do like that.