コード例 #1
0
 public function testEmptyFilterCollection()
 {
     $filters = new FilterCollection();
     $this->assertFalse($filters->rewind());
     $this->assertFalse($filters->end());
     $this->assertFalse($filters->key());
     $this->assertFalse($filters->current());
     $this->assertFalse($filters->valid());
     $this->assertSame(0, count($filters));
 }
コード例 #2
0
 /**
  * Get the next word in queue as a stream.
  * 
  * Get the next word in queue as a stream, after automatically decoding its
  * length.
  * 
  * @return resource The word, as a stream.
  * @see close()
  */
 public function getNextWordAsStream()
 {
     $filters = new T\FilterCollection();
     if (null !== ($remoteCharset = $this->getCharset(self::CHARSET_REMOTE)) && null !== ($localCharset = $this->getCharset(self::CHARSET_LOCAL))) {
         $filters->append('convert.iconv.' . $remoteCharset . '.' . $localCharset . '//IGNORE//TRANSLIT');
     }
     if ($this->trans->isPersistent()) {
         $old = $this->trans->lock(T\Stream::DIRECTION_RECEIVE);
         $stream = $this->trans->receiveStream(self::decodeLength($this->trans), $filters, 'stream word');
         $this->trans->lock($old, true);
     } else {
         $stream = $this->trans->receiveStream(self::decodeLength($this->trans), $filters, 'stream word');
     }
     return $stream;
 }