protected function checkValue($value, $type) { switch ($type) { case 'int': if (PHP_VERSION_ID < 54000) { return $value + 0; } return intval($value); case 'datetime': return Utils\String::createFromFormat($value, $this->getDateFormat()); case 'float': return floatval($value); case 'string': return trim($value); case 'string|null': return trim($value) ?: NULL; } return $value; }
public function createInfo($data, $dateFormat) { $data->dateStart = Utils\String::createFromFormat($data->dateStart, $dateFormat); $data->dateEnd = Utils\String::createFromFormat($data->dateEnd, $dateFormat); return $data; }