Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 final class PrimitiveTimestamp extends PrimitiveDate
00016 {
00017 const HOURS = 'hrs';
00018 const MINUTES = 'min';
00019 const SECONDS = 'sec';
00020
00021 public function importMarried($scope)
00022 {
00023 if (
00024 BasePrimitive::import($scope)
00025 && isset(
00026 $scope[$this->name][self::DAY],
00027 $scope[$this->name][self::MONTH],
00028 $scope[$this->name][self::YEAR]
00029 )
00030 && is_array($scope[$this->name])
00031 ) {
00032 if ($this->isEmpty($scope))
00033 return !$this->isRequired();
00034
00035 $hours = $minutes = $seconds = 0;
00036
00037 if (isset($scope[$this->name][self::HOURS]))
00038 $hours = (int) $scope[$this->name][self::HOURS];
00039
00040 if (isset($scope[$this->name][self::MINUTES]))
00041 $minutes = (int) $scope[$this->name][self::MINUTES];
00042
00043 if (isset($scope[$this->name][self::SECONDS]))
00044 $seconds = (int) $scope[$this->name][self::SECONDS];
00045
00046 $year = (int) $scope[$this->name][self::YEAR];
00047 $month = (int) $scope[$this->name][self::MONTH];
00048 $day = (int) $scope[$this->name][self::DAY];
00049
00050 if (!checkdate($month, $day, $year))
00051 return false;
00052
00053 try {
00054 $stamp = new Timestamp(
00055 $year.'-'.$month.'-'.$day.' '
00056 .$hours.':'.$minutes.':'.$seconds
00057 );
00058 } catch (WrongArgumentException $e) {
00059
00060 return false;
00061 }
00062
00063 if ($this->checkRanges($stamp)) {
00064 $this->value = $stamp;
00065 return true;
00066 }
00067 }
00068
00069 return false;
00070 }
00071
00072 protected function getObjectName()
00073 {
00074 return 'Timestamp';
00075 }
00076 }
00077 ?>