public static function handleRequest() { // handle JSON requests if (static::peekPath() == 'json') { static::$responseMode = static::shiftPath(); } // route request switch ($discussionHandle = static::shiftPath()) { case '': case false: return static::handleBrowseRequest(); default: // lookup discussion by handle if (!($Discussion = Discussion::getByHandle($discussionHandle))) { return static::throwNotFoundError(); } return static::handleDiscussionRequest($Discussion); } }