PHP Class phprs\util\Tree

Mostra file Open project: caoym/phprs-restful

Public Properties

Property Type Description
$end
$wildcard

Public Methods

Method Description
erase ( array $path ) : boolean 删除一个路径下的所有节点
export ( ) : array 树打平输出成数组
find ( array $path, boolean $exact_match = false ) : 返回节点的值, 查找指定路径的节点
findNode ( array $path, boolean $exact_match = false, boolean $all_req_paths = false ) : 返回节点的, 查找指定路径的节点
insert ( array $path, unknown $value, string $replace_exits = false, mixed &$replaced = null ) : boolean 插入一个节点 插入时允许使用通配符*
visit ( array $path, $vistor, $exact_match = false ) : boolean 遍历路径

Private Methods

Method Description
treeToArray ( array $tree, array &$res ) : void
visitNode ( array $path, $vistor, boolean $exact_match = false, boolean $all_req_paths = false ) : boolean 遍历路径

Method Details

erase() public method

删除一个路径下的所有节点
public erase ( array $path ) : boolean
$path array
return boolean

export() public method

树打平输出成数组
public export ( ) : array
return array

find() public method

查找指定路径的节点
public find ( array $path, boolean $exact_match = false ) : 返回节点的值,
$path array
$exact_match boolean 是否精确匹配,如果是,则通配符被认为与其他值不同
return 返回节点的值,

findNode() public method

查找指定路径的节点
public findNode ( array $path, boolean $exact_match = false, boolean $all_req_paths = false ) : 返回节点的,
$path array
$exact_match boolean 是否精确匹配,如果是,则通配符被认为与其他值不同
$all_req_paths boolean 是否要求查询路径的所有元素都必须遍历到
return 返回节点的,

insert() public method

插入一个节点 插入时允许使用通配符*
public insert ( array $path, unknown $value, string $replace_exits = false, mixed &$replaced = null ) : boolean
$path array
$value unknown
$replace_exits string 是否替换已存在的
$replaced mixed 被替换的原始值
return boolean

visit() public method

遍历路径
public visit ( array $path, $vistor, $exact_match = false ) : boolean
$path array
return boolean 全部遍历完返回true,否则返回false

Property Details

$end public_oe static_oe property

public static $end

$wildcard public_oe static_oe property

public static $wildcard