RouterStaticRule.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2008 by Sergey S. Sergeev                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012     final class RouterStaticRule extends RouterBaseRule
00013     {
00014         protected $route    = null;
00015         
00019         public static function create($route)
00020         {
00021             return new self($route);
00022         }
00023         
00024         public function __construct($route)
00025         {
00026             // FIXME: rtrim. probably?
00027             $this->route = trim($route, '/');
00028         }
00029         
00030         public function match(HttpRequest $request)
00031         {
00032             $path = $this->processPath($request)->toString();
00033             
00034             // FIXME: rtrim, probably?
00035             if (trim(urldecode($path), '/') == $this->route)
00036                 return $this->defaults;
00037             
00038             return false;
00039         }
00040         
00041         public function assembly(
00042             array $data = array(),
00043             $reset = false,
00044             $encode = false
00045         )
00046         {
00047             return $this->route;
00048         }
00049     }
00050 ?>