public function render()
{
$output = '';
foreach ($this->scripts as $script) {
if ($source = $script->getSource()) {
$attributes = '';
foreach (['async', 'defer'] as $attribute) {
$attributes .= $script->getOption($attribute) ? ' ' . $attribute : '';
}
$output .= sprintf(" <script src=\"%s\"%s></script>\n", $source, $attributes);
} elseif ($content = $script->getContent()) {
$output .= sprintf(" <script>%s</script>\n", $content);
}
}
return $output;
}