0) return 1; return 0; }); $choosable = array_slice($choosable, 0, 10); $max = 2 + mt_rand() % 2; for ($j = 0; $j < $max; $j++) { $o = $i; $iter = 0; while ($o === $i || has_edge($edges, [$i, $o])) { $o = choose_random($choosable); if ($iter++ > 100) break; } if ($iter <= 100) add_edge($edges, [$i, $o]); } } return [$points, $edges, $sizes]; } function stars_container(array $points, array $sizes) { $html = '
'; return $html; } function stars_edges_svg(array $points, array $edges) { $html = ''; return $html; } function stars_script(array $points, array $edges, array $sizes) { $js = file_get_contents(__DIR__ . '/js/stars.js'); return fill_js($js, [ 'INDICES' => json_encode(range(0, count($points) - 1)), 'POINTS' => json_encode($points), 'EDGES' => json_encode($edges), 'SIZES' => json_encode($sizes), ]); } function stars_styles() { return file_get_contents(__DIR__ . '/css/stars.css'); }