/** * Parse the body of the notification * * @return $this */ public function parse() { $parser = new NotifynderParser(); foreach ($this->items as $key => $item) { $this->items[$key]['text'] = $parser->parse($item); } return $this; }
/** @test */ public function it_will_throw_exception_when_strict_extra_is_enabled() { $extra = null; $notification = ['body' => ['text' => 'Hi {to.username} hello {extra.hello}'], 'to' => ['username' => 'jhon'], 'extra' => json_encode($extra)]; NotifynderParser::setStrictExtra(true); $this->shouldThrow(ExtraParamsException::class)->during('parse', [$notification]); }
/** * Get parsed body attributes. * * @return string */ public function getNotifyBodyAttribute() { $notifynderParse = new NotifynderParser(); return $notifynderParse->parse($this); }
/** * Publish config files */ protected function config() { $this->publishes([__DIR__ . '/../config/notifynder.php' => config_path('notifynder.php'), __DIR__ . '/../migrations/' => base_path('/database/migrations')]); // Set use strict_extra config option, // you can toggle it in the configuraiton file $strictParam = $this->app['config']->get('notifynder.strict_extra', false); NotifynderParser::setStrictExtra($strictParam); }
/** * Publish config files. */ protected function config() { $this->publishes([__DIR__ . '/../config/notifynder.php' => config_path('notifynder.php')]); $this->mergeConfigFrom(__DIR__ . '/../config/notifynder.php', 'notifynder'); // Set use strict_extra config option, // you can toggle it in the configuration file $strictParam = $this->app['config']->get('notifynder.strict_extra', false); NotifynderParser::setStrictExtra($strictParam); }