public function toArray()
    {
        return array_filter(
            [
                'text' => $this->getText(),
                'notification' => $this->getNotification(),
                'markdown' => $this->getMarkdown(),
                'channel' => $this->getChannel(),
                'user' => $this->getUser(),
                'attachments' => $this->getAttachments(),
            ],
            function ($value, $key) {
                return ! (
                    is_null($value) ||
                    ($key === 'markdown' && $value === true) ||
                    (is_array($value) && empty($value))
                );
            },
            ARRAY_FILTER_USE_BOTH
        );
    }
public function toArray()
    {
        return array_filter(
            [
                'text' => $this->getText(),
                'notification' => $this->getNotification(),
                'markdown' => $this->getMarkdown(),
                'channel' => $this->getChannel(),
                'user' => $this->getUser(),
                'attachments' => $this->getAttachments(),
            ],
            function ($value, $key) {
                return ! (
                    is_null($value) ||
                    ($key === 'markdown' && $value === true) ||
                    (is_array($value) && empty($value))
                );
            },
            ARRAY_FILTER_USE_BOTH
        );
    }
public function toArray ( ) { return array_filter ( [ 'text' => $ this -> getText ( ) , 'notification' => $ this -> getNotification ( ) , 'markdown' => $ this -> getMarkdown ( ) , 'channel' => $ this -> getChannel ( ) , 'user' => $ this -> getUser ( ) , 'attachments' => $ this -> getAttachments ( ) , ] , function ( $ value , $ key ) { return ! ( is_null ( $ value ) || ( $ key === 'markdown' && $ value === true ) || ( is_array ( $ value ) && empty ( $ value ) ) ) ; } , ARRAY_FILTER_USE_BOTH ) ; }
Convert the message to an array.

@return array
Convert the message to an array .