Пример #1
0
 public function __toString()
 {
     if ($this->children->count()) {
         $childNameList = array();
         foreach ($this->children as $child) {
             $childNameList[] = $child->getName();
         }
         return sprintf('%s [%s]', $this->role, implode(', ', $childNameList));
     }
     return sprintf('%s', $this->role);
 }
Пример #2
0
 /**
  * (PHP 5 &gt;= 5.1.0)<br/>
  * Returns if an iterator can be created for the current entry.
  * @link http://php.net/manual/en/recursiveiterator.haschildren.php
  * @return bool true if the current entry can be iterated over, otherwise returns false.
  */
 public function hasChildren()
 {
     return $this->children->count() > 0;
 }