public static checkStringLengthAndEncoding ( $string, $max_len, $encoding ) |
public function toArray() { $this->checkRecipient(); return ['recipient' => ['id' => $this->recipient_id], 'message' => ['attachment' => ['type' => 'template', 'payload' => ['template_type' => 'button', 'text' => MessengerUtils::checkStringLengthAndEncoding($this->text, 320, 'UTF-8'), 'buttons' => MessengerUtils::checkArraySize($this->buttons, 3)]]]]; }
public function toArray() { $payload_name = $this->type == ButtonType::Web || $this->type == ButtonType::AccountLink ? 'url' : 'payload'; if ($this->type == ButtonType::AccountLink) { return ['type' => $this->type, 'url' => $this->payload]; } if ($this->type == ButtonType::AccountUnlink) { return ['type' => $this->type]; } if ($this->is_webview) { $result = ['type' => $this->type, $payload_name => $this->payload, 'title' => MessengerUtils::checkStringLengthAndEncoding($this->title, 320, 'UTF-8'), 'webview_height_ratio' => $this->webview_height_ratio]; if ($this->is_webview_extended) { $result['messenger_extensions'] = true; if (!is_null($this->fallback_url)) { $result['fallback_url'] = $this->fallback_url; } } return $result; } return ['type' => $this->type, $payload_name => $this->payload, 'title' => MessengerUtils::checkStringLengthAndEncoding($this->title, 320, 'UTF-8')]; }
public function toArray() { $this->checkRecipient(); return ['recipient' => ['id' => $this->recipient_id], 'message' => ['text' => MessengerUtils::checkStringLengthAndEncoding($this->text, 320, 'UTF-8'), 'quick_replies' => MessengerUtils::checkArraySize($this->replies, 10)]]; }