public function parse($notification)
    {
        $category = $notification->category;
        if (is_null($category)) {
            throw (new ModelNotFoundException)->setModel(
                NotificationCategory::class, $notification->category_id
            );
        }
        $text = $category->template_body;

        $specialValues = $this->getValues($text);
        if (count($specialValues) > 0) {
            $specialValues = array_filter($specialValues, function ($value) use ($notification) {
                return ((is_array($notification) && isset($notification[$value])) || (is_object($notification) && isset($notification->$value))) || starts_with($value, ['extra.', 'to.', 'from.']);
            });

            foreach ($specialValues as $replacer) {
                $replace = $this->mixedGet($notification, $replacer);
                if (empty($replace) && notifynder_config()->isStrict()) {
                    throw new ExtraParamsException("The following [$replacer] param required from your category is missing.");
                }
                $text = $this->replace($text, $replace, $replacer);
            }
        }

        return $text;
    }
public function parse($notification)
    {
        $category = $notification->category;
        if (is_null($category)) {
            throw (new ModelNotFoundException)->setModel(
                NotificationCategory::class, $notification->category_id
            );
        }
        $text = $category->template_body;

        $specialValues = $this->getValues($text);
        if (count($specialValues) > 0) {
            $specialValues = array_filter($specialValues, function ($value) use ($notification) {
                return ((is_array($notification) && isset($notification[$value])) || (is_object($notification) && isset($notification->$value))) || starts_with($value, ['extra.', 'to.', 'from.']);
            });

            foreach ($specialValues as $replacer) {
                $replace = $this->mixedGet($notification, $replacer);
                if (empty($replace) && notifynder_config()->isStrict()) {
                    throw new ExtraParamsException("The following [$replacer] param required from your category is missing.");
                }
                $text = $this->replace($text, $replace, $replacer);
            }
        }

        return $text;
    }
public function parse ( $ notification ) { $ category = $ notification -> category ; if ( is_null ( $ category ) ) { throw ( new ModelNotFoundException ) -> setModel ( NotificationCategory :: class , $ notification -> category_id ) ; } $ text = $ category -> template_body ; $ specialValues = $ this -> getValues ( $ text ) ; if ( count ( $ specialValues ) > 0 ) { $ specialValues = array_filter ( $ specialValues , function ( $ value ) use ( $ notification ) { return ( ( is_array ( $ notification ) && isset ( $ notification [ $ value ] ) ) || ( is_object ( $ notification ) && isset ( $ notification -> $ value ) ) ) || starts_with ( $ value , [ 'extra.' , 'to.' , 'from.' ] ) ; } ) ; foreach ( $ specialValues as $ replacer ) { $ replace = $ this -> mixedGet ( $ notification , $ replacer ) ; if ( empty ( $ replace ) && notifynder_config ( ) -> isStrict ( ) ) { throw new ExtraParamsException ( "The following [$replacer] param required from your category is missing." ) ; } $ text = $ this -> replace ( $ text , $ replace , $ replacer ) ; } } return $ text ; }
Parse a notification and return the body text.

@param ModelNotification $notification
@return string
@throws ExtraParamsException
Parse a notification and return the body text .