public static function checkStringEncoding($string, $encoding) { if (!mb_detect_encoding($string, $encoding, true)) { throw CouldNotCreateMessage::incorrectEncoding($encoding); } return $string; }
public function setGreetingText($text) { return $this->api->callApi('me/thread_settings', ['setting_type' => 'greeting', 'greeting' => ['text' => MessengerUtils::checkStringEncoding(MessengerUtils::checkStringLength($text, 160), 'UTF-8')]]); }