コード例 #1
0
 public function importValue($value)
 {
     if ($value) {
         Assert::isTrue($value instanceof Time);
     } else {
         return parent::importValue(null);
     }
     return $this->importSingle(array($this->getName() => $value->toFullString()));
 }
コード例 #2
0
 public function importValue($value)
 {
     if ($value) {
         $this->checkType($value);
     } else {
         return parent::importValue(null);
     }
     $singleScope = array($this->getName() => $value->toString());
     $marriedRaw = array(self::DAY => $value->getDay(), self::MONTH => $value->getMonth(), self::YEAR => $value->getYear());
     if ($value instanceof Timestamp) {
         $marriedRaw[PrimitiveTimestamp::HOURS] = $value->getHour();
         $marriedRaw[PrimitiveTimestamp::MINUTES] = $value->getMinute();
         $marriedRaw[PrimitiveTimestamp::SECONDS] = $value->getSecond();
     }
     $marriedScope = array($this->getName() => $marriedRaw);
     if ($this->getState()->isTrue()) {
         return $this->importSingle($singleScope);
     } elseif ($this->getState()->isFalse()) {
         return $this->importMarried($marriedScope);
     } else {
         if (!$this->importMarried($marriedScope)) {
             return $this->importSingle($singleScope);
         }
         return $this->imported = true;
     }
 }