src/HSCore/Driver.php
public function send($command)
    {
        $string = $command;

        $timer = microtime(true);

        while ($string) {
            $bytes = fwrite($this->socket, $string);

            if ($bytes === false) {
                $this->close();
                throw new HSException('Cannot write to socket');
            }

            if ($bytes === 0) {
                return null;
            }

            $string = substr($string, $bytes);
        }

        $this->logs[] = [
            'type' => 'sended',
            'time' => microtime(true) - $timer,
            'command' => $command
        ];

        return $this->receive();
    }
public function send($command)
    {
        $string = $command;

        $timer = microtime(true);

        while ($string) {
            $bytes = fwrite($this->socket, $string);

            if ($bytes === false) {
                $this->close();
                throw new HSException('Cannot write to socket');
            }

            if ($bytes === 0) {
                return null;
            }

            $string = substr($string, $bytes);
        }

        $this->logs[] = [
            'type' => 'sended',
            'time' => microtime(true) - $timer,
            'command' => $command
        ];

        return $this->receive();
    }
public function send ( $ command ) { $ string = $ command ; $ timer = microtime ( true ) ; while ( $ string ) { $ bytes = fwrite ( $ this -> socket , $ string ) ; if ( $ bytes === false ) { $ this -> close ( ) ; throw new HSException ( 'Cannot write to socket' ) ; } if ( $ bytes === 0 ) { return null ; } $ string = substr ( $ string , $ bytes ) ; } $ this -> logs [ ] = [ 'type' => 'sended' , 'time' => microtime ( true ) - $ timer , 'command' => $ command ] ; return $ this -> receive ( ) ; }
Send string command to server

@param string $command
@return string
@throws HSException
Send string command to server