format($format) == $date; } /** * @return array */ static function buildTree(array $elements, string $parentId): array { $branch = []; foreach ($elements as $key => $el) { if($el['ark_parent']['value'] === $parentId){ $el['name'] = $el['name_child']['value']; $el['ark'] = $el['ark_child']['value']; $children = self::buildTree($elements, $el['ark_child']['value']); if($children){ $el['children'] = $children; }else{ $el['value'] = 1; } unset($el['ark_child'], $el['ark_parent'], $el['name_child']); $branch[] = $el; } } return $branch; } }