/**
  * 确定异常是否由于是链接丢失造成的
  *
  * @param  \Exception  $e
  * @return bool
  */
 protected function causedByLostConnection(Exception $e)
 {
     $message = $e->getMessage();
     return Str::contains($message, ['server has gone away', 'no connection to the server', 'Lost connection', 'is dead or not enabled', 'Error while sending', 'decryption failed or bad record mac', 'server closed the connection unexpectedly', 'SSL connection has been closed unexpectedly', 'Deadlock found when trying to get lock', 'Error writing data to the connection']);
 }
Example #2
0
 /**
  * 移除一个监听事件
  * @param string|array $event 事件
  * @return void
  */
 public function remove($event)
 {
     if (Str::contains($event, '*')) {
         unset($this->wildcards[$event]);
     } else {
         unset($this->listeners[$event], $this->sorted[$event]);
     }
 }
Example #3
0
 /**
  * 判断指定字符串是否包含指定内容
  *
  * @param  string  $haystack
  * @param  string|array  $needles
  * @return bool
  */
 function str_contains($haystack, $needles)
 {
     return Str::contains($haystack, $needles);
 }