Fenos\Notifynder\Parsers\NotifynderParser::parse PHP Метод

parse() публичный Метод

Parse the body of a notification with your extras values or relation values.
public parse ( $item ) : string
$item
Результат string
    public function parse($item)
    {
        $body = $item['body']['text'];
        $item['extra'] = $this->extraToArray($item['extra']);
        $specialValues = $this->getValues($body);
        if (count($specialValues) > 0) {
            $specialValues = array_filter($specialValues, function ($value) {
                return starts_with($value, 'extra.') || starts_with($value, 'to.') || starts_with($value, 'from.');
            });
            foreach ($specialValues as $replacer) {
                $replace = $this->mixedGet($item, $replacer);
                if (empty($replace) && static::$strictMode) {
                    $error = "the following [{$replacer}] param required from your category it's missing. Did you forget to store it?";
                    throw new ExtraParamsException($error);
                }
                $body = $this->replaceBody($body, $replace, $replacer);
            }
        }
        return $body;
    }

Usage Example

 /**
  * 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;
 }
All Usage Examples Of Fenos\Notifynder\Parsers\NotifynderParser::parse