/** * get next level configs * * @param ConfigEntity $config config instance * @return array */ public function children(ConfigEntity $config) { $descendants = $this->repo->fetchChildren($config->siteKey, $config->name); $children = []; /** @var ConfigEntity $descendant */ foreach ($descendants as $descendant) { if ($descendant->getDepth() == $config->getDepth() + 1) { $children[] = $this->build($descendant); } } return $children; }
/** * search descendants getter * * @param string $siteKey site key * @param string $name the name * @return array */ public function fetchChildren($siteKey, $name) { return $this->repo->fetchChildren($siteKey, $name); }