| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | public function map(Field $field) |
||
| 45 | { |
||
| 46 | if (is_numeric($field->value)) { |
||
| 47 | $date = new DateTime("@{$field->value}"); |
||
| 48 | } else { |
||
| 49 | try { |
||
| 50 | $date = new DateTime($field->value); |
||
| 51 | } catch (Exception $e) { |
||
| 52 | throw new InvalidArgumentException('Invalid date provided: ' . $field->value); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | return $date->format('Y-m-d\\TH:i:s\\Z'); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.