| 1 |
<?php |
| 2 |
|
| 3 |
namespace TablePress\PhpOffice\PhpSpreadsheet\Reader; |
| 4 |
|
| 5 |
use TablePress\PhpOffice\PhpSpreadsheet\Reader\Exception as ReaderException; |
| 6 |
|
| 7 |
class CsvNoEscape extends Csv |
| 8 |
{ |
| 9 |
/** |
| 10 |
* The character that can escape the enclosure. |
| 11 |
* Non-null-string will probably become unsupported in Php 9. |
| 12 |
* It must always be null-string in this class. |
| 13 |
*/ |
| 14 |
protected ?string $escapeCharacter = ''; |
| 15 |
|
| 16 |
/** |
| 17 |
* Should not be needed in this class, but we will permit it. |
| 18 |
* |
| 19 |
* @var ?callable |
| 20 |
*/ |
| 21 |
protected static $constructorCallback; |
| 22 |
|
| 23 |
protected bool $testAutodetect = false; |
| 24 |
|
| 25 |
/** |
| 26 |
* Changing escape character not allowed in this class. |
| 27 |
*/ |
| 28 |
public function setEscapeCharacter(string $escapeCharacter, int $version = PHP_VERSION_ID): self |
| 29 |
{ |
| 30 |
if ($escapeCharacter !== '') { |
| 31 |
throw new ReaderException('Escape character must be null string'); |
| 32 |
} |
| 33 |
|
| 34 |
$this->escapeCharacter = $escapeCharacter; |
| 35 |
|
| 36 |
return $this; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Changing auto-detect not allowed in this class. |
| 41 |
*/ |
| 42 |
public function setTestAutoDetect(bool $value): self |
| 43 |
{ |
| 44 |
if ($value !== false) { |
| 45 |
throw new ReaderException('This class requires that testAutoDetect be false'); |
| 46 |
} |
| 47 |
$this->testAutodetect = $value; |
| 48 |
|
| 49 |
return $this; |
| 50 |
} |
| 51 |
} |
| 52 |
|