original_string: public function baseWrite()
      {
          set_error_handler(function(){});
          if ($this->transport === 'ssl') {
              $len = fwrite($this->_socket, $this->_sendBuffer, 8192);
          } else {
              $len = fwrite($this->_socket, $this->_sendBuffer);
          }
          restore_error_handler();
          if ($len === strlen($this->_sendBuffer)) {
              $this->bytesWritten += $len;
              Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);
              $this->_sendBuffer = '';
              // Try to emit onBufferDrain callback when the send buffer becomes empty.
              if ($this->onBufferDrain) {
                  try {
                      call_user_func($this->onBufferDrain, $this);
                  } catch (\Exception $e) {
                      Worker::log($e);
                      exit(250);
                  } catch (\Error $e) {
                      Worker::log($e);
                      exit(250);
                  }
              }
              if ($this->_status === self::STATUS_CLOSING) {
                  $this->destroy();
              }
              return true;
          }
          if ($len > 0) {
              $this->bytesWritten += $len;
              $this->_sendBuffer = substr($this->_sendBuffer, $len);
          } else {
              self::$statistics['send_fail']++;
              $this->destroy();
          }
      }
code: public function baseWrite()
      {
          set_error_handler(function(){});
          if ($this->transport === 'ssl') {
              $len = fwrite($this->_socket, $this->_sendBuffer, 8192);
          } else {
              $len = fwrite($this->_socket, $this->_sendBuffer);
          }
          restore_error_handler();
          if ($len === strlen($this->_sendBuffer)) {
              $this->bytesWritten += $len;
              Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);
              $this->_sendBuffer = '';
              // Try to emit onBufferDrain callback when the send buffer becomes empty.
              if ($this->onBufferDrain) {
                  try {
                      call_user_func($this->onBufferDrain, $this);
                  } catch (\Exception $e) {
                      Worker::log($e);
                      exit(250);
                  } catch (\Error $e) {
                      Worker::log($e);
                      exit(250);
                  }
              }
              if ($this->_status === self::STATUS_CLOSING) {
                  $this->destroy();
              }
              return true;
          }
          if ($len > 0) {
              $this->bytesWritten += $len;
              $this->_sendBuffer = substr($this->_sendBuffer, $len);
          } else {
              self::$statistics['send_fail']++;
              $this->destroy();
          }
      }
code_tokens: public function baseWrite ( ) { set_error_handler ( function ( ) { } ) ; if ( $ this -> transport === 'ssl' ) { $ len = fwrite ( $ this -> _socket , $ this -> _sendBuffer , 8192 ) ; } else { $ len = fwrite ( $ this -> _socket , $ this -> _sendBuffer ) ; } restore_error_handler ( ) ; if ( $ len === strlen ( $ this -> _sendBuffer ) ) { $ this -> bytesWritten += $ len ; Worker :: $ globalEvent -> del ( $ this -> _socket , EventInterface :: EV_WRITE ) ; $ this -> _sendBuffer = '' ; // Try to emit onBufferDrain callback when the send buffer becomes empty. if ( $ this -> onBufferDrain ) { try { call_user_func ( $ this -> onBufferDrain , $ this ) ; } catch ( \ Exception $ e ) { Worker :: log ( $ e ) ; exit ( 250 ) ; } catch ( \ Error $ e ) { Worker :: log ( $ e ) ; exit ( 250 ) ; } } if ( $ this -> _status === self :: STATUS_CLOSING ) { $ this -> destroy ( ) ; } return true ; } if ( $ len > 0 ) { $ this -> bytesWritten += $ len ; $ this -> _sendBuffer = substr ( $ this -> _sendBuffer , $ len ) ; } else { self :: $ statistics [ 'send_fail' ] ++ ; $ this -> destroy ( ) ; } }
docstring: Base write handler.
  
  @return void|bool
docstring_tokens: Base write handler .