Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
DateTimeToString
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 convert
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2namespace Apie\StorageMetadata\Converters;
3
4use Apie\TypeConverter\ConverterInterface;
5use DateTimeInterface;
6use ReflectionType;
7
8/**
9 * @implements ConverterInterface<DateTimeInterface, string>
10 */
11class DateTimeToString implements ConverterInterface
12{
13    public function convert(?DateTimeInterface $input, ?ReflectionType $wantedType): ?string
14    {
15        if ($input === null && $wantedType->allowsNull()) {
16            return null;
17        }
18        return $input->format(DateTimeInterface::ATOM);
19    }
20}