@@ 122-129 (lines=8) @@ | ||
119 | $pathValue = null; |
|
120 | if ($this->hasValue($data, $path)) { |
|
121 | $value = $this->getValue($data, $path); |
|
122 | if ((null === $value) || (is_string($value))) { |
|
123 | $pathValue = $value; |
|
124 | } else { |
|
125 | throw new \InvalidArgumentException( |
|
126 | sprintf("Value expected to be a string, but %s given", gettype($value)), |
|
127 | 400 |
|
128 | ); |
|
129 | } |
|
130 | } |
|
131 | $this->restorePath(); |
|
132 | ||
@@ 231-242 (lines=12) @@ | ||
228 | $value = $this->getValue($data, $path); |
|
229 | if (null === $value) { |
|
230 | $pathValue = $value; |
|
231 | } else { |
|
232 | if (is_string($value)) { |
|
233 | $pathValue = \DateTimeImmutable::createFromFormat($format, $value); |
|
234 | } |
|
235 | ||
236 | if (!$pathValue instanceof \DateTimeImmutable) { |
|
237 | throw new \InvalidArgumentException( |
|
238 | sprintf("Value expected to be a date/time string in '%s' format", $format), |
|
239 | 400 |
|
240 | ); |
|
241 | } |
|
242 | } |
|
243 | } |
|
244 | ||
245 | $this->restorePath(); |