You are here

protected function Kint_Parsers_Timestamp::_parse in Devel 8.2

Same name and namespace in other branches
  1. 8 kint/kint/parsers/custom/timestamp.php \Kint_Parsers_Timestamp::_parse()

* main and usually single method a custom parser must implement * *

Parameters

mixed $variable: * * @return mixed [!!!] false is returned if the variable is not of current type

Overrides kintParser::_parse

File

kint/kint/parsers/custom/timestamp.php, line 19

Class

Kint_Parsers_Timestamp

Code

protected function _parse(&$variable) {
  if (!self::_fits($variable)) {
    return false;
  }
  $var = strlen($variable) === 13 ? substr($variable, 0, -3) : $variable;
  $this->type = 'timestamp';

  # avoid dreaded "Timezone must be set" error
  $this->value = @date('Y-m-d H:i:s', $var);
}