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); }
/** * (PHP 5 >= 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; }