Example #1
0
 public function importValue($value)
 {
     if ($value) {
         Assert::isTrue($value instanceof Time);
     } else {
         return parent::importValue(null);
     }
     return $this->importSingle([$this->getName() => $value->toFullString()]);
 }
Example #2
0
 public function importValue($value)
 {
     if ($value) {
         $this->checkType($value);
     } else {
         return parent::importValue(null);
     }
     $singleScope = [$this->getName() => $value->toString()];
     $marriedRaw = [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 = [$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;
     }
 }