public function selectCompatible($datatype) { if ($datatype == ArrayDataTypeHandler::DATA_TYPE) { return $datatype; } return parent::selectCompatible($datatype); }
protected function adjustValue($value) { $adjustedValue = parent::adjustValue($value); if (is_string($adjustedValue)) { $adjustedValue = str_replace(' ', '', $adjustedValue); } return $adjustedValue; }
protected function isParsableImpl(&$value) { if (!parent::isParsableImpl($value)) { return FALSE; } $result = $this->testValue($value); return isset($result); }
protected function isParsableImpl(&$value) { if (!parent::isParsableImpl($value)) { return FALSE; } // We need at least two '/', '-', '.' or ' ' to proceed $characterUsage = count_chars($value, 1); if (!$this->checkCharacterUsage($characterUsage)) { return FALSE; } return TRUE; }
public function castValue($value) { $adjustedValue = parent::castValue($value); if (!isset($adjustedValue)) { return NULL; } if (is_bool($adjustedValue)) { // do nothing. It is already correct type } else { $result = $this->testValue($adjustedValue); if (isset($result)) { $adjustedValue = $result; } else { throw new IllegalArgumentException(t('Incorrect value of type BOOLEAN: @value', array('@value' => $adjustedValue))); } } return $adjustedValue; }
public function castValue($value) { $adjustedValue = parent::castValue($value); if (!isset($adjustedValue)) { return NULL; } // do not use procedural style. We need an exception in case of error try { $dt = new DateTime($adjustedValue); } catch (Exception $e) { LogHelper::log_error($e); throw new IllegalArgumentException(t('Failed to parse date and/or time string: @value', array('@value' => $adjustedValue))); } return $dt->format($this->getMask()); }