protected function prepareContentData($record)
    {
        $dataArray = array(
            'token'       => $this->token,
            'channel'     => $this->channel,
            'username'    => $this->username,
            'text'        => '',
            'attachments' => array(),
        );

        if ($this->formatter) {
            $message = $this->formatter->format($record);
        } else {
            $message = $record['message'];
        }

        if ($this->useAttachment) {
            $attachment = array(
                'fallback' => $message,
                'color'    => $this->getAttachmentColor($record['level']),
                'fields'   => array(),
            );

            if ($this->useShortAttachment) {
                $attachment['title'] = $record['level_name'];
                $attachment['text'] = $message;
            } else {
                $attachment['title'] = 'Message';
                $attachment['text'] = $message;
                $attachment['fields'][] = array(
                    'title' => 'Level',
                    'value' => $record['level_name'],
                    'short' => true,
                );
            }

            if ($this->includeContextAndExtra) {
                if (!empty($record['extra'])) {
                    if ($this->useShortAttachment) {
                        $attachment['fields'][] = array(
                            'title' => "Extra",
                            'value' => $this->stringify($record['extra']),
                            'short' => $this->useShortAttachment,
                        );
                    } else {
                        // Add all extra fields as individual fields in attachment
                        foreach ($record['extra'] as $var => $val) {
                            $attachment['fields'][] = array(
                                'title' => $var,
                                'value' => $val,
                                'short' => $this->useShortAttachment,
                            );
                        }
                    }
                }

                if (!empty($record['context'])) {
                    if ($this->useShortAttachment) {
                        $attachment['fields'][] = array(
                            'title' => "Context",
                            'value' => $this->stringify($record['context']),
                            'short' => $this->useShortAttachment,
                        );
                    } else {
                        // Add all context fields as individual fields in attachment
                        foreach ($record['context'] as $var => $val) {
                            $attachment['fields'][] = array(
                                'title' => $var,
                                'value' => $val,
                                'short' => $this->useShortAttachment,
                            );
                        }
                    }
                }
            }

            $dataArray['attachments'] = json_encode(array($attachment));
        } else {
            $dataArray['text'] = $message;
        }

        if ($this->iconEmoji) {
            $dataArray['icon_emoji'] = ":{$this->iconEmoji}:";
        }

        return $dataArray;
    }
protected function prepareContentData($record)
    {
        $dataArray = array(
            'token'       => $this->token,
            'channel'     => $this->channel,
            'username'    => $this->username,
            'text'        => '',
            'attachments' => array(),
        );

        if ($this->formatter) {
            $message = $this->formatter->format($record);
        } else {
            $message = $record['message'];
        }

        if ($this->useAttachment) {
            $attachment = array(
                'fallback' => $message,
                'color'    => $this->getAttachmentColor($record['level']),
                'fields'   => array(),
            );

            if ($this->useShortAttachment) {
                $attachment['title'] = $record['level_name'];
                $attachment['text'] = $message;
            } else {
                $attachment['title'] = 'Message';
                $attachment['text'] = $message;
                $attachment['fields'][] = array(
                    'title' => 'Level',
                    'value' => $record['level_name'],
                    'short' => true,
                );
            }

            if ($this->includeContextAndExtra) {
                if (!empty($record['extra'])) {
                    if ($this->useShortAttachment) {
                        $attachment['fields'][] = array(
                            'title' => "Extra",
                            'value' => $this->stringify($record['extra']),
                            'short' => $this->useShortAttachment,
                        );
                    } else {
                        // Add all extra fields as individual fields in attachment
                        foreach ($record['extra'] as $var => $val) {
                            $attachment['fields'][] = array(
                                'title' => $var,
                                'value' => $val,
                                'short' => $this->useShortAttachment,
                            );
                        }
                    }
                }

                if (!empty($record['context'])) {
                    if ($this->useShortAttachment) {
                        $attachment['fields'][] = array(
                            'title' => "Context",
                            'value' => $this->stringify($record['context']),
                            'short' => $this->useShortAttachment,
                        );
                    } else {
                        // Add all context fields as individual fields in attachment
                        foreach ($record['context'] as $var => $val) {
                            $attachment['fields'][] = array(
                                'title' => $var,
                                'value' => $val,
                                'short' => $this->useShortAttachment,
                            );
                        }
                    }
                }
            }

            $dataArray['attachments'] = json_encode(array($attachment));
        } else {
            $dataArray['text'] = $message;
        }

        if ($this->iconEmoji) {
            $dataArray['icon_emoji'] = ":{$this->iconEmoji}:";
        }

        return $dataArray;
    }
protected function prepareContentData ( $ record ) { $ dataArray = array ( 'token' => $ this -> token , 'channel' => $ this -> channel , 'username' => $ this -> username , 'text' => '' , 'attachments' => array ( ) , ) ; if ( $ this -> formatter ) { $ message = $ this -> formatter -> format ( $ record ) ; } else { $ message = $ record [ 'message' ] ; } if ( $ this -> useAttachment ) { $ attachment = array ( 'fallback' => $ message , 'color' => $ this -> getAttachmentColor ( $ record [ 'level' ] ) , 'fields' => array ( ) , ) ; if ( $ this -> useShortAttachment ) { $ attachment [ 'title' ] = $ record [ 'level_name' ] ; $ attachment [ 'text' ] = $ message ; } else { $ attachment [ 'title' ] = 'Message' ; $ attachment [ 'text' ] = $ message ; $ attachment [ 'fields' ] [ ] = array ( 'title' => 'Level' , 'value' => $ record [ 'level_name' ] , 'short' => true , ) ; } if ( $ this -> includeContextAndExtra ) { if ( ! empty ( $ record [ 'extra' ] ) ) { if ( $ this -> useShortAttachment ) { $ attachment [ 'fields' ] [ ] = array ( 'title' => "Extra" , 'value' => $ this -> stringify ( $ record [ 'extra' ] ) , 'short' => $ this -> useShortAttachment , ) ; } else { // Add all extra fields as individual fields in attachment foreach ( $ record [ 'extra' ] as $ var => $ val ) { $ attachment [ 'fields' ] [ ] = array ( 'title' => $ var , 'value' => $ val , 'short' => $ this -> useShortAttachment , ) ; } } } if ( ! empty ( $ record [ 'context' ] ) ) { if ( $ this -> useShortAttachment ) { $ attachment [ 'fields' ] [ ] = array ( 'title' => "Context" , 'value' => $ this -> stringify ( $ record [ 'context' ] ) , 'short' => $ this -> useShortAttachment , ) ; } else { // Add all context fields as individual fields in attachment foreach ( $ record [ 'context' ] as $ var => $ val ) { $ attachment [ 'fields' ] [ ] = array ( 'title' => $ var , 'value' => $ val , 'short' => $ this -> useShortAttachment , ) ; } } } } $ dataArray [ 'attachments' ] = json_encode ( array ( $ attachment ) ) ; } else { $ dataArray [ 'text' ] = $ message ; } if ( $ this -> iconEmoji ) { $ dataArray [ 'icon_emoji' ] = ":{$this->iconEmoji}:" ; } return $ dataArray ; }
Prepares content data

@param  array $record
@return array
Prepares content data