original_string: public function write($buffer, $addNewLine = true) {
  
          if (!$this->socket) {
              throw new \Exception("Telnet connection closed");
          }
  
          // clear buffer from last command
          $this->clearBuffer();
  
          if ($addNewLine == true) {
              $buffer .= "\n";
          }
  
          $this->global_buffer .= $buffer;
          if ($this->debug_mode === 2 || $this->debug_mode === 3) {
              $this->log($buffer);
          }
          if (!fwrite($this->socket, $buffer) < 0) {
              throw new \Exception("Error writing to socket");
          }
  
          return true;
      }
code: public function write($buffer, $addNewLine = true) {
  
          if (!$this->socket) {
              throw new \Exception("Telnet connection closed");
          }
  
          // clear buffer from last command
          $this->clearBuffer();
  
          if ($addNewLine == true) {
              $buffer .= "\n";
          }
  
          $this->global_buffer .= $buffer;
          if ($this->debug_mode === 2 || $this->debug_mode === 3) {
              $this->log($buffer);
          }
          if (!fwrite($this->socket, $buffer) < 0) {
              throw new \Exception("Error writing to socket");
          }
  
          return true;
      }
code_tokens: public function write ( $ buffer , $ addNewLine = true ) { if ( ! $ this -> socket ) { throw new \ Exception ( "Telnet connection closed" ) ; } // clear buffer from last command $ this -> clearBuffer ( ) ; if ( $ addNewLine == true ) { $ buffer .= "\n" ; } $ this -> global_buffer .= $ buffer ; if ( $ this -> debug_mode === 2 || $ this -> debug_mode === 3 ) { $ this -> log ( $ buffer ) ; } if ( ! fwrite ( $ this -> socket , $ buffer ) < 0 ) { throw new \ Exception ( "Error writing to socket" ) ; } return true ; }
docstring: Write command to a socket
  
  @param string $buffer Stuff to write to socket
  @param boolean $addNewLine Default true, adds newline to the command
  @return boolean
docstring_tokens: Write command to a socket