Exemple #1
0
 /**
  * @param string $content
  */
 private function changeEncoding($content)
 {
     $this->tokenStore->setEncoding(Bom::getEncoding($content));
     $types = $this->tokenStore->getTokens();
     $this->minLength = count($types) > 0 ? strlen(array_keys($types)[0]) * 2 : 1;
     $this->buffer->setMinBufferSize($this->minLength);
 }
Exemple #2
0
 public function testMove()
 {
     $stream = $this->makeStream('first second third fourth');
     $buffer = new StreamBuffer($stream, 10, 2);
     $buffer->read();
     static::assertEquals('first seco', $buffer->getContents());
     $buffer->move(9);
     static::assertEquals('o', $buffer->getContents());
     $buffer->read();
     static::assertEquals('ond third f', $buffer->getContents());
 }