public function route(Request $request) { $path = new StringValue($request->path()); if ($path->starts('/api/')) { Api\Router::create('/api/')->route($request); return; } if ($path->starts('/')) { } }
private function pushItem($item) { if ($this->itemIndex >= 16) { $this->phpTable = trim($this->phpTable); $this->phpTable .= "\n"; $this->itemIndex = 0; } ++$this->itemIndex; $item = new StringValue($item); if ($item->starts('\\x') || $item->starts('\\n')) { $this->phpTable .= '"' . $item . '", '; $this->nonQuestionBoxFound = true; } else { // TODO check if this hack should be removed for chinese letters if ($item->value === '[?] ') { $item->value = '[?]'; } // if ($item->value !== '[?]') { $this->nonQuestionBoxFound = true; } $this->phpTable .= "'" . str_replace(array('\\', '\''), array('\\\\', '\\\''), $item) . "', "; } }
public function route() { $path = new StringValue($this->request->path()); switch (true) { case $path->starts('/?') || '/' === $path->value: IndexController::ActionIndex(); break; case $path->value === '/albums': AlbumController::create($this->request)->actionIndex(); break; case $path->starts('/albums/details'): AlbumController::create($this->request)->actionDetails(); break; case $path->starts('/albums/create'): AlbumController::create($this->request)->actionCreate(); break; case $path->starts('/albums/upload/receive'): AlbumController::create($this->request)->actionUploadReceive(); break; case $path->starts('/auth/vk'): AuthController::create($this->request)->oauthEndPoint(); break; case $path->value === '/auth/register': AuthController::create($this->request)->actionRegister(); break; case $path->value === '/auth/sign-in': AuthController::create($this->request)->actionSignIn(); break; case $path->value === '/auth/register/receive': AuthController::create($this->request)->actionRegisterReceive(); break; case $path->value === '/upload': UploadController::create($this->request)->indexAction(); break; case $path->starts('/upload/receive'): UploadController::create($this->request)->receiveAction(); break; default: IndexController::NotFoundAction(); break; } }