Lines Matching refs:value

23      * may be null as this is a stored value
24 * but throw a not found exception when the value is null
38 $value = $this->getValue();
43 return $this->toPersistentDateTimeUtility($value);
51 * @param DateTime|null $value
54 public function setValue($value): Metadata
56 if ($value === null) {
60 if (!($value instanceof DateTime)) {
61 throw new ExceptionRuntime("The value is not a date time. Value: " . var_export($value, true));
63 $this->dateTimeValue = $value;
70 public function setFromStoreValue($value): Metadata
72 return $this->setValue($this->fromPersistentDateTimeUtility($value));
87 $message = "The date time ($this) has a default value ($defaultValue) that is not valid. Error: {$e->getMessage()}";
102 $value = $this->getReadStore()->get($this);
104 $this->dateTimeValue = $this->fromPersistentDateTimeUtility($value);
115 protected function fromPersistentDateTimeUtility($value)
117 if ($value === null || $value === "") {
120 if (!is_string($value)) {
121 throw new ExceptionBadArgument("This is not a string value");
123 return Iso8601Date::createFromString($value)->getDateTime();
140 * @throws ExceptionBadArgument - if the value is not valid
142 private function toPersistentDateTimeUtility($value): string
144 if ($value === null) {
145 throw new ExceptionBadArgument("The passed value is null");
147 if (!($value instanceof DateTime)) {
150 return Iso8601Date::createFromDateTime($value)->toString();
163 public function setFromStoreValueWithoutException($value): Metadata
166 $this->dateTimeValue = $this->fromPersistentDateTimeUtility($value);