本文整理匯總了PHP中app\Message::italic方法的典型用法代碼示例。如果您正苦於以下問題:PHP Message::italic方法的具體用法?PHP Message::italic怎麽用?PHP Message::italic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Message
的用法示例。
在下文中一共展示了Message::italic方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
if ($message->user->login === \Auth::user()->login) {
return $message;
}
// Personal message
$isBotMention = $message->hasMention(function (User $user) {
return $user->login === \Auth::user()->login;
});
if ($isBotMention) {
//$this->ai->handle($message);
} else {
// Hello all
$isHello = Str::contains($message->text_without_special_chars, \Lang::get('personal.hello_query'));
if ($isHello) {
$id = array_rand(\Lang::get('personal.hello'));
$message->italic(\Lang::get('personal.hello.' . $id, ['user' => $message->user->login]));
}
// Question
$isQuestion = Str::contains($message->text_without_special_chars, ['можно задать вопрос', 'хочу задать вопрос']);
if ($isQuestion) {
$message->italic(sprintf('@%s, и какой ответ ты ожидаешь услышать?', $message->user->login));
}
}
return $message;
}
示例2: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
$isImage = preg_match('/[^`]http(?:s)?:\\/\\/.*?\\.(?:jpg|png|jpeg|svg|bmp)/iu', ' ' . $message->text);
$isVideo = preg_match('/[^`]http(?:s)?:\\/\\/(?:www\\.)?(?:youtube\\.com|youtu\\.be).*?/iu', ' ' . $message->text);
if (($isImage || $isVideo) && $message->user->login !== \Auth::user()->login) {
$answer = \Lang::get('gitter.inline', ['user' => $message->user->login]);
$message->italic($answer);
}
return $message;
}
示例3: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
$text = $message->text;
$lines = count(explode("\n", $text));
$chars = mb_strlen($text);
if (preg_match_all('/^((`{3}\\s*)(\\w+)?(\\s*([\\w\\W]+?)\\n*)\\2)\\n*(?:[^\\S\\w\\s]|$)/m', $text, $matches)) {
$codeLines = 0;
foreach ($matches[5] as $code) {
$codeLines += count(explode("\n", $code));
}
if ($codeLines > self::MAX_CODE_LINES) {
$answer = \Lang::get('long.code_personal', ['user' => $message->user->login]);
$message->italic($answer);
return null;
}
} elseif ($lines > self::MAX_LINES || $chars > self::MAX_CHARS) {
$answer = \Lang::get('long.text_personal', ['user' => $message->user->login]);
$message->italic($answer);
return null;
}
return $message;
}
示例4: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
$text = $message->escaped_text;
if (preg_match('/^(@.*?\\s)?(?:оформи\\sкод|код\\sоформи).*?$/isu', $text)) {
$hasMentions = count($message->mentions);
$mention = null;
if ($hasMentions) {
$mention = $message->mentions[0]->login === \Auth::user()->login ? $message->user : $message->mentions[0];
}
$answer = $mention ? \Lang::get('markdown.personal', ['user' => $mention->login]) : \Lang::get('markdown.common');
$message->italic($answer);
return null;
}
return $message;
}
示例5: answer
/**
* @param Message $message
* @param $text
*/
protected function answer(Message $message, $text)
{
$this->lastAnswer = $text;
$message->italic(sprintf('@%s, ' . $text, $this->user->login));
}