public function checkWhere(Route $route) { $where = $route->getWhere(); $params = $route->getParams(); foreach ($params as $key => $value) { if (isset($where[$key])) { if (!preg_match($where[$key]['regexp'], $value)) { if (isset($where[$key]['default'])) { $params[$key] = $where[$key]['default']; $route->setParams($params); } else { return false; } } } } return true; }