GrafiteInc/Forms

View on GitHub
src/Html/Span.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php

namespace Grafite\Forms\Html;

use Grafite\Forms\Html\HtmlSnippet;
use Grafite\Forms\Builders\AttributeBuilder;

class Span extends HtmlSnippet
{
    public static function render($options = [])
    {
        $content = '';

        $attributes = app(AttributeBuilder::class)->render($options['attributes']);

        if (isset($options['content'])) {
            $content = $options['content'];
        }

        throw_if(empty($content), 'You cannot have an empty span');

        return "<span {$attributes}>{$content}</span>";
    }
}