Skip to content

Commit

Permalink
add function assemble to NF_Route for yaf 2.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
xw2423 committed Feb 10, 2014
1 parent ce0d2fe commit 9a9bd97
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/inc/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class NF_Route implements Yaf_Route_Interface{
private $_match = array();
private $_verify = array();
private $_current = null;
private $_var_null = array();
private $_strict = false;

public function __construct ($match , $route = array(), $verify = array(), $strict = null){
Expand Down Expand Up @@ -66,11 +67,19 @@ public function route($request){
return false;
}

public function assemble(array $info, array $query = array()){
$url = $this->_routes[0]->assemble($info, $query);
foreach($this->_var_null as $v){
$url = str_replace('/:' . $v, '', $url);
}
return $url;
}

private function _get_null($route){
$tmp = array();
foreach($route as $k=>$v){
if($v === null) $tmp[] = $k;
}
return $tmp;
return $this->_var_null = $tmp;
}
}

0 comments on commit 9a9bd97

Please sign in to comment.