Exemplo n.º 1
0
 public function handle(IConnectionSingle $connection, $rawLength)
 {
     if (!is_numeric($rawLength)) {
         Utils::onCommunicationException(new MalformedServerResponse($connection, "Cannot parse '{$rawLength}' as data length"));
     }
     $listLength = (int) $rawLength;
     if ($listLength === -1) {
         return null;
     }
     $list = array();
     if ($listLength > 0) {
         $reader = $connection->getResponseReader();
         for ($i = 0; $i < $listLength; $i++) {
             $list[] = $reader->read($connection);
         }
     }
     return $list;
 }
Exemplo n.º 2
0
 public function __construct(IConnectionSingle $connection, $size)
 {
     $this->_connection = $connection;
     $this->_reader = $connection->getResponseReader();
     $this->_position = 0;
     $this->_current = $size > 0 ? $this->getValue() : null;
     $this->_replySize = $size;
 }