- foreach ($result as $relatedName) {
- if (in_array($relatedName, $accumulated)) {
- throw new \Exception("Circular sequence reference from '{$name}' to '{$relatedName}'.");
- }
- if (!isset($list[$relatedName])) {
- continue;
- }
- $relatedResult = $this->expandSequence($list, $relatedName, $accumulated);
- $result = array_unique(array_merge($result, $relatedResult));
- }
- return $result;
- }