# fluent-community/trunk/app/Services/EmailDomBuilder.php

FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS &amp; Online Courses, version trunk. 73 lines.

- Page: https://pluginprobe.com/plugins/fluent-community/trunk/code/app/Services/EmailDomBuilder.php
- Raw: https://pluginprobe.com/plugins/fluent-community/trunk/raw/app/Services/EmailDomBuilder.php
- Modified: 2024-11-07T12:38:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-community/trunk/code/app/Services/EmailDomBuilder.php#L10-L20`.

```php
<?php

namespace FluentCommunity\App\Services;

class EmailDomBuilder
{
    protected $config = [];

    protected $elements = [];

    public function __construct($config = [])
    {
        $defaults = [
            'font_size'   => '14px',
            'font_family' => 'Arial, Helvetica, sans-serif',
        ];

        $this->config = $config;
    }

    public function line($content, $tag = 'p')
    {
        $this->elements[] = [
            'type'    => 'line',
            'tag'     => $tag,
            'content' => $content,
        ];
        return $this;
    }

    public function heading($content, $tag = 'h2')
    {
        $this->elements[] = [
            'type'    => 'heading',
            'tag'     => $tag,
            'content' => $content,
        ];
        return $this;
    }

    public function button($url, $btnText, $style = 'primary')
    {
        $this->elements[] = [
            'type'    => 'button',
            'content' => $btnText,
            'url'     => $url,
            'style'   => $style
        ];
        return $this;
    }

    public function url($url, $content)
    {
        $this->elements[] = [
            'type'    => 'url',
            'content' => $content,
            'url'     => $url,
        ];
        return $this;
    }

    public function image($imageUrl, $alt = '')
    {
        $this->elements[] = [
            'type'    => 'image',
            'content' => $imageUrl,
            'alt'     => $alt,
        ];
        return $this;
    }

}

```
