# fluentform/6.2.4/app/Services/FormBuilder/NotificationParser.php

Fluent Forms – Customizable Contact Forms, Survey, Quiz, &amp; Conversational Form Builder, version 6.2.4. 48 lines.

- Page: https://pluginprobe.com/plugins/fluentform/6.2.4/code/app/Services/FormBuilder/NotificationParser.php
- Raw: https://pluginprobe.com/plugins/fluentform/6.2.4/raw/app/Services/FormBuilder/NotificationParser.php
- Modified: 2022-10-16T13:42:18+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/fluentform/6.2.4/code/app/Services/FormBuilder/NotificationParser.php#L10-L20`.

```php
<?php

namespace FluentForm\App\Services\FormBuilder;

use FluentForm\App\Services\FormBuilder\ShortCodeParser;

class NotificationParser
{
    protected static $cache = null;

    /**
     * Parse Norifications
     *
     * @param array  $notifications
     * @param int    $insertId
     * @param array  $data
     * @param object $form
     *
     * @return bool $cache
     */
    public static function parse($notifications, $insertId, $data, $form, $cache = true)
    {
        if ($cache && ! is_null(static::$cache)) {
            return static::$cache;
        }

        foreach ($notifications as &$notification) {
            static::setRecepient($notification, $data);

            $notification = ShortCodeParser::parse(
                $notification,
                $insertId,
                $data,
                $form
            );
        }

        return $cache ? (static::$cache = $notifications) : $notifications;
    }

    protected static function setRecepient(&$notification, $data)
    {
        if (isset($notification['sendTo']) && 'field' == $notification['sendTo']['type']) {
            $notification['sendTo']['email'] = $data[$notification['sendTo']['field']];
        }
    }
}

```
