ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Cell_DefaultValueBinder Class Reference
+ Inheritance diagram for PHPExcel_Cell_DefaultValueBinder:
+ Collaboration diagram for PHPExcel_Cell_DefaultValueBinder:

Public Member Functions

 bindValue (PHPExcel_Cell $cell, $value=null)
 Bind value to a cell. More...
 
 bindValue (PHPExcel_Cell $cell, $value=NULL)
 Bind value to a cell. More...
 

Static Public Member Functions

static dataTypeForValue ($pValue=null)
 DataType for value. More...
 

Detailed Description

Definition at line 46 of file DefaultValueBinder.php.

Member Function Documentation

◆ bindValue()

PHPExcel_Cell_DefaultValueBinder::bindValue ( PHPExcel_Cell  $cell,
  $value = null 
)

Bind value to a cell.

Parameters
PHPExcel_Cell$cellCell to bind value to
mixed$valueValue to bind in cell
Returns
boolean

Implements PHPExcel_Cell_IValueBinder.

Reimplemented in PHPExcel_Cell_AdvancedValueBinder.

Definition at line 55 of file DefaultValueBinder.php.

56 {
57 // sanitize UTF-8 strings
58 if (is_string($value)) {
60 } elseif (is_object($value)) {
61 // Handle any objects that might be injected
62 if ($value instanceof DateTime) {
63 $value = $value->format('Y-m-d H:i:s');
64 } elseif (!($value instanceof PHPExcel_RichText)) {
65 $value = (string) $value;
66 }
67 }
68
69 // Set value explicit
70 $cell->setValueExplicit( $value, self::dataTypeForValue($value) );
71
72 // Done!
73 return true;
74 }
setValueExplicit($pValue=NULL, $pDataType=PHPExcel_Cell_DataType::TYPE_STRING)
Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the ...
Definition: Cell.php:225
static SanitizeUTF8($value)
Try to sanitize UTF8, stripping invalid byte sequences.
Definition: String.php:383

References PHPExcel_Shared_String\SanitizeUTF8(), and PHPExcel_Cell\setValueExplicit().

+ Here is the call graph for this function:

◆ dataTypeForValue()

static PHPExcel_Cell_DefaultValueBinder::dataTypeForValue (   $pValue = null)
static

DataType for value.

Parameters
mixed$pValue
Returns
string

Definition at line 82 of file DefaultValueBinder.php.

82 {
83 // Match the value against a few data types
84 if ($pValue === null) {
86 } elseif ($pValue === '') {
88 } elseif ($pValue instanceof PHPExcel_RichText) {
90 } elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
92 } elseif (is_bool($pValue)) {
94 } elseif (is_float($pValue) || is_int($pValue)) {
96 } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
97 $tValue = ltrim($pValue, '+-');
98 if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.' ) {
100 } elseif((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
102 }
104 } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
106 }
107
109 }
static getErrorCodes()
Get list of error codes.
Definition: DataType.php:68

References PHPExcel_Cell_DataType\getErrorCodes(), PHPExcel_Cell_DataType\TYPE_BOOL, PHPExcel_Cell_DataType\TYPE_ERROR, PHPExcel_Cell_DataType\TYPE_FORMULA, PHPExcel_Cell_DataType\TYPE_INLINE, PHPExcel_Cell_DataType\TYPE_NULL, PHPExcel_Cell_DataType\TYPE_NUMERIC, and PHPExcel_Cell_DataType\TYPE_STRING.

Referenced by PHPExcel_Cell_DataType\dataTypeForValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: