gets instance of command form

@param Fluent $fluent
@param mixed $notification
@return FormBuilder
17090
protected function form(Fluent $fluent, $notification = null)
    {
        publish('notifications', 'scripts.resources-default');
        Event::fire('antares.forms', 'notification.' . $fluent->form_name);
        $fluent->type = $fluent->type === '' ? 'email' : $fluent->type;

        return new Form($notification, $fluent);
    }
1309110
public function getRecipients(NotificationEntity $notification)
    {
        $ids = $this->getRecipientIDs($notification);
        // be sure we have integers
        $ids = array_map('intval', $ids);
        // remove problematic IDs
        $ids = array_filter($ids);
        // remove duplicated
        $ids = array_unique($ids, SORT_REGULAR);
        if (!empty($ids)) {
            $repo = $this->app->make(UserInfoRepository::class);
            /* @var UserInfoRepository $repo */
            foreach ($ids as $id) {
                $userInfo = $repo->getByID($id);
                if ($userInfo !== null && $userInfo->isActive()) {
                    yield $userInfo;
                }
            }
        }
    }
284484
private function generateMessage($notification)
    {
        $message = ucfirst($notification['type']) . '\n\n';

        if ( ! is_null($notification['title'])) {
            $message .= $this->escapeTitle($notification['title']) . '\n\n';
        }

        return $this->escapeMessage($message . $notification['message']);
    }
977547
protected function composeMessage($notification)
    {
        if(empty($this->message['to'])){
            throw new InvalidConfigException('The "to" option must be set in EmailChannel::message.');
        }
        $message = $this->mailer->compose();
        Yii::configure($message, $this->message);
        $message->setSubject((string)$notification->getTitle());
        $message->setTextBody((string)$notification->getDescription());
        return $message;
    }
485579
public function compileObject(Fluent $fluent)
    {
        $blueprint = new Blueprint($fluent->type);

        /* @var \Closure $callback */
        $callback = $fluent->callback;

        if (is_callable($callback)) {
            $callback($blueprint);
        }

        return [
            'properties' => $this->compileFields($blueprint->getFields()),
        ];
    }
161279
public function notifynderNotifications()
    {
        $model = app('notifynder.resolver.model')->getModel(Notification::class);
        if (notifynder_config()->isPolymorphic()) {
            return $this->morphMany($model, 'to');
        }

        return $this->hasMany($model, 'to_id');
    }
955644
protected function getNotificationContentData($fluent, $langId, $key = 'title')
    {
        foreach ($fluent->contents as $content) {
            if ($langId !== $content['lang_id']) {
                continue;
            }
            return array_get($content, $key);
        }
        return '';
    }
1134840
protected function messageBuilder($notifiable, $notification, $message)
    {
        return function ($mailMessage) use ($notifiable, $notification, $message) {
            $this->buildMessage($mailMessage, $notifiable, $notification, $message);
        };
    }
798100
public function sendNotification($notification)
    {
        $subscriberIds = $notification->subscriberIds->toArray();
        $query = $this->getService('repos:people.person')
                       ->getQuery(true)
                       ->id($subscriberIds);

        $people = $query->fetchSet();

        $settings = $this->getService('repos:notifications.setting')
                         ->getQuery(true, array('actor.id' => $notification->target->id))
                         ->fetchSet();

        $settings = AnHelperArray::indexBy($settings, 'person.id');

        $mails = $this->_renderMails(array(
                        'notification' => $notification,
                        'people' => $people,
                        'settings' => $settings
                    ));

        $this->mail($mails);
    }
1371037
protected function getQuery(Notification $notification)
    {
        $query = $this->getQueryInstance();
        $query
            ->where('from_id', $notification->from_id)
            ->where('from_type', $notification->from_type)
            ->where('to_id', $notification->to_id)
            ->where('to_type', $notification->to_type)
            ->where('category_id', $notification->category_id);
        $extra = $notification->extra;
        if (! is_null($extra) && ! empty($extra)) {
            if (is_array($extra)) {
                $extra = json_encode($extra);
            }
            $query->where('extra', $extra);
        }

        return $query;
    }
175445
private function createCommandProphecy()
    {
        $prophet = new Prophet;
        $prophecy = $prophet->prophesize()->willImplement(InlineConfigCommandInterface::class);
        $prophecy
            ->setName('foo')
            ->shouldBeCalled();
        $prophecy
            ->getConfig()
            ->willReturn(['name'=>'foo']);

        return $prophecy;
    }
1108135
public static function mark_notification_as_read($notification, $timeread = null) {
        global $DB;

        if (is_null($timeread)) {
            $timeread = time();
        }

        if (is_null($notification->timeread)) {
            $updatenotification = new \stdClass();
            $updatenotification->id = $notification->id;
            $updatenotification->timeread = $timeread;

            $DB->update_record('notifications', $updatenotification);

            // Trigger event for reading a notification.
            \core\event\notification_viewed::create_from_ids(
                $notification->useridfrom,
                $notification->useridto,
                $notification->id
            )->trigger();
        }
    }
501938
protected function getData($notifiable, Notification $notification)
    {
        if (method_exists($notification, 'toBroadcast')) {
            return $notification->toBroadcast($notifiable);
        }

        if (method_exists($notification, 'toArray')) {
            return $notification->toArray($notifiable);
        }

        throw new RuntimeException('Notification is missing toArray method.');
    }
966935
public function send($notifiables, $notification)
    {
        return (new NotificationSender(
            $this, $this->app->make(Bus::class), $this->app->make(Dispatcher::class), $this->locale)
        )->send($notifiables, $notification);
    }
1155530
public function sendNow($notifiables, $notification, array $channels = null)
    {
        return (new NotificationSender(
            $this, $this->app->make(Bus::class), $this->app->make(Dispatcher::class), $this->locale)
        )->sendNow($notifiables, $notification, $channels);
    }
340123
protected function prepareNotification(Notification $notification, $params = array())
    {
        $data = array_filter($notification->toArray());
        // Prevent from duplicating context items
        unset($data['context']);

        $params += array('origin' => php_sapi_name() == 'cli' ? 'cli' : 'http');
        $params += array('reported_at' => new \DateTime());
        $params += array('server' => $this->getServerName());

        $mergedData = array_merge($data, $params);

        $notification->hydrate($mergedData);

        return $notification;
    }
608649
public function run(array $notification, array $variables = null, array $recipients = null)
    {
        $typeName = Arr::get($notification, 'type.name');

        switch ($typeName) {
            case 'email':
                $instance = app(EmailNotification::class);
                break;
            case 'sms':
                $instance = app(SmsNotification::class);
                break;
            default:
                $instance = app(CustomNotification::class);
                break;
        }
        $instance->setPredefinedVariables($variables);
        $instance->setModel($notification);

        if ($instance instanceof SendableNotification) {
            $instance->setRecipients($recipients);

            if (!$this->validate($instance)) {
                return false;
            }
            $type = $instance->getType();
            $job  = $instance->onConnection('database')->onQueue($type);
            $this->dispatch($job);
        } else {
            return $instance->handle();
        }
    }