@@ -44,19 +44,19 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function convert($value) |
| 46 | 46 | { |
| 47 | - try { |
|
| 47 | + try{ |
|
| 48 | 48 | $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value); |
| 49 | - if (!$datetime instanceof DateTimeImmutable) { |
|
| 49 | + if (!$datetime instanceof DateTimeImmutable){ |
|
| 50 | 50 | return null; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ($this->convertInto !== null) { |
|
| 53 | + if ($this->convertInto !== null){ |
|
| 54 | 54 | $formatted = $datetime->format($this->convertInto); |
| 55 | 55 | return is_string($formatted) ? $formatted : null; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $datetime; |
| 59 | - } catch (Throwable $e) { |
|
| 59 | + }catch (Throwable $e){ |
|
| 60 | 60 | return null; |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -44,19 +44,24 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function convert($value) |
| 46 | 46 | { |
| 47 | - try { |
|
| 47 | + try |
|
| 48 | + { |
|
| 48 | 49 | $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value); |
| 49 | - if (!$datetime instanceof DateTimeImmutable) { |
|
| 50 | + if (!$datetime instanceof DateTimeImmutable) |
|
| 51 | + { |
|
| 50 | 52 | return null; |
| 51 | 53 | } |
| 52 | 54 | |
| 53 | - if ($this->convertInto !== null) { |
|
| 55 | + if ($this->convertInto !== null) |
|
| 56 | + { |
|
| 54 | 57 | $formatted = $datetime->format($this->convertInto); |
| 55 | 58 | return is_string($formatted) ? $formatted : null; |
| 56 | 59 | } |
| 57 | 60 | |
| 58 | 61 | return $datetime; |
| 59 | - } catch (Throwable $e) { |
|
| 62 | + } |
|
| 63 | + catch (Throwable $e) |
|
| 64 | + { |
|
| 60 | 65 | return null; |
| 61 | 66 | } |
| 62 | 67 | } |