stylesheets as $css) if ($css === $url) return; $this->stylesheets []= $url; } public function addScript(string $url, bool $defer = false) { foreach ($this->scripts as &$script) { if ($script[0] === $url) { if (!$defer && $script[1]) $script[1] = false; // upgrade from defered to immediate script return; } } $this->scripts []= [ $url, $defer ]; } }