Pop\Nav\Nav::setTree PHP Метод

setTree() публичный Метод

Set the nav tree
public setTree ( array $tree = null ) : Nav
$tree array
Результат Nav
    public function setTree(array $tree = null)
    {
        $this->tree = null !== $tree ? $tree : array();
        return $this;
    }

Usage Example

Пример #1
0
 public function testAddBranch()
 {
     $tree = array(array('name' => 'First Nav Item', 'href' => '/first'));
     $branch = array('name' => 'Second Nav Item', 'href' => '/second');
     $n = new Nav();
     $n->setTree($tree);
     $n->addBranch($branch);
     $t = $n->getTree();
     $this->assertEquals('Second Nav Item', $t[1]['name']);
 }