Skip to content

Commit 6eadacf

Browse files
authored
Merge pull request #59 from ioggstream/patch-2
Refactor hasElementChildren
2 parents c5293f7 + a7f91c9 commit 6eadacf

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

graph.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
<h2>Navigation</h2>
1111
<?php
1212
include_once "data.php";
13-
function hasElementChildren($element) {
14-
$hasContent = false;
15-
foreach ($element as $activityName => $content) {
16-
if (!array_key_exists("dependsOn", $content)) {
17-
continue;
18-
}
19-
$hasContent = true;
13+
14+
/** Return true if has dependsOn. */
15+
function hasElementChildren($activities) {
16+
foreach ($activities as $activityName => $activity) {
17+
if ($activity["dependsOn"] ?? null)
18+
return true;
2019
}
21-
return $hasContent;
20+
return false;
2221
}
2322

2423
foreach ($dimensions as $dimension => $subdimensions) {
@@ -211,4 +210,4 @@ function transform(d) {
211210
<?php
212211
}
213212
}
214-
?>
213+
?>

0 commit comments

Comments
 (0)