Пример #1
0
 /**
  * Write UTF-8 BOM code if encoding is UTF-8 and useBom is set to true
  *
  * @return AbstractCsv
  */
 protected function writeBom()
 {
     if ($this->dialect->getUseBom() && $this->dialect->getEncoding() == 'UTF-8') {
         // Write the UTF-8 BOM code
         if ($this->isFileOpened()) {
             fwrite($this->fileHandler, "");
         }
     }
     return $this;
 }
Пример #2
0
 /**
  * @dataProvider providerGetSetEncoding
  */
 public function testGetSetEncoding($input, $expected)
 {
     $this->assertInstanceOf('CSanquer\\ColibriCsv\\Dialect', $this->dialect->setEncoding($input));
     $this->assertEquals($expected, $this->dialect->getEncoding());
 }
Пример #3
0
 /**
  * Remove BOM in the provided string
  *
  * @param  string $str
  * @return string
  */
 protected function removeBom($str)
 {
     return $str !== false && $this->dialect->getUseBom() ? str_replace($this->transcoder->getBOM($this->dialect->getEncoding()), '', $str) : $str;
 }