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

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

- Page: https://pluginprobe.com/plugins/fluentform/3.6.65/code/app/Services/FormBuilder/NotificationParser.php
- Raw: https://pluginprobe.com/plugins/fluentform/3.6.65/raw/app/Services/FormBuilder/NotificationParser.php
- Modified: 2018-06-28T15:49:10+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/3.6.65/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']) && $notification['sendTo']['type'] == 'field') {
            $notification['sendTo']['email'] = $data[$notification['sendTo']['field']];
        }
    }
}

```
