@@ 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 | ||
@@ 193-204 (lines=12) @@ | ||
190 | $value = $this->getValue($data, $path); |
|
191 | if (null === $value) { |
|
192 | $pathValue = $value; |
|
193 | } else { |
|
194 | if (is_string($value)) { |
|
195 | $pathValue = \DateTimeImmutable::createFromFormat($format, $value); |
|
196 | } |
|
197 | ||
198 | if (!$pathValue instanceof \DateTimeImmutable) { |
|
199 | throw new \InvalidArgumentException( |
|
200 | sprintf("Value expected to be a date/time string in '%s' format", $format), |
|
201 | 400 |
|
202 | ); |
|
203 | } |
|
204 | } |
|
205 | } |
|
206 | ||
207 | $this->restorePath(); |