type = self::TYPE_TEXT_CARD; } public function title($title) { $this->attr['title'] = $title; return $this; } public function desc($desc) { $this->attr['description'] = $desc; return $this; } public function button($text) { $this->attr['btntxt'] = $text; return $this; } public function url($url) { $this->attr['url'] = $url; return $this; } public function toArray() { $arr = [ 'msgtype' => $this->type, $this->type => [ 'title' => $this->attr['title'], 'description' => $this->attr['description'], 'url' => $this->attr['url'], 'btntxt' => $this->attr['btntxt'], ], 'safe' => $this->safe, ]; if (!empty($this->params)) { $arr = array_merge($this->params, $arr); } return $arr; } }