GrafiteInc/Forms

View on GitHub
src/Html/Div.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php

namespace Grafite\Forms\Html;

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

class Div 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 div');

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