@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | if ($this->_socket !== false) { |
552 | 552 | return; |
553 | 553 | } |
554 | - $connection = ($this->unixSocket ?: $this->hostname . ':' . $this->port) . ', database=' . $this->database; |
|
554 | + $connection = ($this->unixSocket ?: $this->hostname.':'.$this->port).', database='.$this->database; |
|
555 | 555 | $this->_socket = @stream_socket_client( |
556 | - $this->unixSocket ? 'unix://' . $this->unixSocket : 'tcp://' . $this->hostname . ':' . $this->port, |
|
556 | + $this->unixSocket ? 'unix://'.$this->unixSocket : 'tcp://'.$this->hostname.':'.$this->port, |
|
557 | 557 | $errorNumber, |
558 | 558 | $errorDescription, |
559 | 559 | $this->connectionTimeout ? $this->connectionTimeout : ini_get('default_socket_timeout'), |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | public function close() |
584 | 584 | { |
585 | 585 | if ($this->_socket !== false) { |
586 | - $connection = ($this->unixSocket ?: $this->hostname . ':' . $this->port) . ', database=' . $this->database; |
|
586 | + $connection = ($this->unixSocket ?: $this->hostname.':'.$this->port).', database='.$this->database; |
|
587 | 587 | try { |
588 | 588 | $this->executeCommand('QUIT'); |
589 | 589 | } catch (SocketException $e) { |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | $this->open(); |
667 | 667 | |
668 | 668 | $params = array_merge(explode(' ', $name), $params); |
669 | - $command = '*' . count($params) . "\r\n"; |
|
669 | + $command = '*'.count($params)."\r\n"; |
|
670 | 670 | foreach ($params as $arg) { |
671 | - $command .= '$' . mb_strlen($arg, '8bit') . "\r\n" . $arg . "\r\n"; |
|
671 | + $command .= '$'.mb_strlen($arg, '8bit')."\r\n".$arg."\r\n"; |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | if ($this->retries > 0) { |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | { |
699 | 699 | $written = @fwrite($this->_socket, $command); |
700 | 700 | if ($written === false) { |
701 | - throw new SocketException("Failed to write to socket.\nRedis command was: " . $command); |
|
701 | + throw new SocketException("Failed to write to socket.\nRedis command was: ".$command); |
|
702 | 702 | } |
703 | 703 | if ($written !== ($len = mb_strlen($command, '8bit'))) { |
704 | - throw new SocketException("Failed to write to socket. $written of $len bytes written.\nRedis command was: " . $command); |
|
704 | + throw new SocketException("Failed to write to socket. $written of $len bytes written.\nRedis command was: ".$command); |
|
705 | 705 | } |
706 | 706 | return $this->parseResponse(implode(' ', $params)); |
707 | 707 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | private function parseResponse($command) |
720 | 720 | { |
721 | 721 | if (($line = fgets($this->_socket)) === false) { |
722 | - throw new SocketException("Failed to read from socket.\nRedis command was: " . $command); |
|
722 | + throw new SocketException("Failed to read from socket.\nRedis command was: ".$command); |
|
723 | 723 | } |
724 | 724 | $type = $line[0]; |
725 | 725 | $line = mb_substr($line, 1, -2, '8bit'); |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | return $line; |
732 | 732 | } |
733 | 733 | case '-': // Error reply |
734 | - throw new Exception("Redis error: " . $line . "\nRedis command was: " . $command); |
|
734 | + throw new Exception("Redis error: ".$line."\nRedis command was: ".$command); |
|
735 | 735 | case ':': // Integer reply |
736 | 736 | // no cast to int as it is in the range of a signed 64 bit integer |
737 | 737 | return $line; |
@@ -739,11 +739,11 @@ discard block |
||
739 | 739 | if ($line == '-1') { |
740 | 740 | return null; |
741 | 741 | } |
742 | - $length = (int)$line + 2; |
|
742 | + $length = (int) $line + 2; |
|
743 | 743 | $data = ''; |
744 | 744 | while ($length > 0) { |
745 | 745 | if (($block = fread($this->_socket, $length)) === false) { |
746 | - throw new SocketException("Failed to read from socket.\nRedis command was: " . $command); |
|
746 | + throw new SocketException("Failed to read from socket.\nRedis command was: ".$command); |
|
747 | 747 | } |
748 | 748 | $data .= $block; |
749 | 749 | $length -= mb_strlen($block, '8bit'); |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | return $data; |
761 | 761 | default: |
762 | - throw new Exception('Received illegal data from redis: ' . $line . "\nRedis command was: " . $command); |
|
762 | + throw new Exception('Received illegal data from redis: '.$line."\nRedis command was: ".$command); |
|
763 | 763 | } |
764 | 764 | } |
765 | 765 | } |