summaryrefslogtreecommitdiffstats
path: root/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php
new file mode 100644
index 0000000..974487e
--- /dev/null
+++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace PhpOffice\PhpSpreadsheet\Cell;
+
+use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
+
+class StringValueBinder implements IValueBinder
+{
+ /**
+ * Bind value to a cell.
+ *
+ * @param Cell $cell Cell to bind value to
+ * @param mixed $value Value to bind in cell
+ *
+ * @return bool
+ */
+ public function bindValue(Cell $cell, $value)
+ {
+ // sanitize UTF-8 strings
+ if (is_string($value)) {
+ $value = StringHelper::sanitizeUTF8($value);
+ }
+
+ $cell->setValueExplicit((string) $value, DataType::TYPE_STRING);
+
+ // Done!
+ return true;
+ }
+}