Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/utility/formatters/date_formatter.php
Show First 20 Lines • Show All 366 Lines • ▼ Show 20 Line(s) | |||||
return $res; | return $res; | ||||
} | } | ||||
/** | /** | ||||
* Converts formatted date+time to timestamp and validates format | * Converts formatted date+time to timestamp and validates format | ||||
* | * | ||||
* @param mixed $value | * @param mixed $value | ||||
* @param string $field_name | * @param string $field_name | ||||
* @param kDBItem $object | * @param kDBItem $object | ||||
Lint: CodingStandard.Commenting.DocComment.TagValueIndent: Tag value indented incorrectly; expected 2 spaces but found 1 | |||||
Missing parameter comment Lint: CodingStandard.Commenting.FunctionComment.MissingParamComment: Missing parameter comment | |||||
* @param string $format Format. | |||||
Expected 5 spaces after parameter name; 1 found Lint: CodingStandard.Commenting.FunctionComment.SpacingAfterParamName: Expected 5 spaces after parameter name; 1 found | |||||
Tag value indented incorrectly; expected 2 spaces but found 1 Lint: CodingStandard.Commenting.DocComment.TagValueIndent: Tag value indented incorrectly; expected 2 spaces but found 1 | |||||
* @return mixed | * @return mixed | ||||
Tag cannot be grouped with parameter tags in a doc comment Lint: CodingStandard.Commenting.DocComment.NonParamGroup: Tag cannot be grouped with parameter tags in a doc comment | |||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function Parse($value, $field_name, &$object) | public function Parse($value, $field_name, &$object, $format = null) | ||||
Type hint "kDBItem" missing for $object Lint: CodingStandard.Commenting.FunctionComment.TypeHintMissing: Type hint "kDBItem" missing for $object | |||||
{ | { | ||||
$options = $object->GetFieldOptions($field_name); | $options = $object->GetFieldOptions($field_name); | ||||
$dt_separator = getArrayValue($options,'date_time_separator'); | $dt_separator = getArrayValue($options,'date_time_separator'); | ||||
if($dt_separator) $value = trim($value, $dt_separator); | if($dt_separator) $value = trim($value, $dt_separator); | ||||
if($value == '') return NULL; | if($value == '') return NULL; | ||||
//return strtotime($value); | //return strtotime($value); | ||||
if ( !isset($format) ) { | |||||
$format = $options['input_format']; | $format = $options['input_format']; | ||||
} | |||||
if ($dt_separator) $format = trim($format, $dt_separator); | if ($dt_separator) $format = trim($format, $dt_separator); | ||||
Inline control structures are not allowed Lint: Generic.ControlStructures.InlineControlStructure.NotAllowed: Inline control structures are not allowed | |||||
Expected 1 spaces before "if" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "if" closing bracket; 0 found | |||||
Expected 1 spaces after "if" opening bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "if" opening bracket; 0 found | |||||
$error_params = array( | $error_params = array( | ||||
'format' => $this->HumanFormat($format), | 'format' => $this->HumanFormat($format), | ||||
'sample' => adodb_date($format), | 'sample' => adodb_date($format), | ||||
'value' => $value, | 'value' => $value, | ||||
); | ); | ||||
$hour = 0; | $hour = 0; | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |
Tag value indented incorrectly; expected 2 spaces but found 1