darya/framework

Autoloader and Http API consolidation

Closed this issue · 2 comments

Autoloader::registerNamespaces() might as well just be Autoloader::namespaces(). setBasePath() and getBasePath() can be consolidated to either basePath() or base(). The static classBaseName() could just become className() and not be public.

Request::session($key) would be helpful. Not sure whether to consolidate Request::setSession() and Request::getSession() into this same method; might be making a single method do far too many things at once, but I love single word methods! Oh the trade off.

Response::getStatus() and Response::setStatus() can easily just become Request::status(). Maybe the same for setCookie() and getCookie()? deleteCookie() should probably stay.

Removed Response::addContent(), consolidate Response::setContent() and Response::getContent(). Keep hasContent().

Session magic methods might be nice too!

Edit: Also improve View API.

  • View::setFile(), View::setDir(), View::setConfig() to View::file(), View::directory(), View::config()
  • View::getAssigned() and View::getShared() to View::assigned() and View::shared()

c050a45 improves Request and Session APIs.

23e28db fixes up some Response stuff.