Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 /**
  * @param null|string[]|string $bom
  *
  * @return static
  */
 public function setBom($bom)
 {
     $this->boms = $bom;
     if (!is_null($bom)) {
         $testBom = is_array($bom) ? reset($bom) : $bom;
         Bom::getEncoding($testBom);
     }
     return $this;
 }
Ejemplo n.º 3
0
 public function testGetEncodingWillThrowAnExceptionForUnknownBom()
 {
     static::expectException(InvalidArgumentException::class);
     Bom::getEncoding('random');
 }