Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| IntToAutoIncrementTable | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| convert | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\StorageMetadata\Converters; |
| 3 | |
| 4 | use Apie\Core\Utils\ConverterUtils; |
| 5 | use Apie\StorageMetadata\Interfaces\AutoIncrementTableInterface; |
| 6 | use Apie\TypeConverter\ConverterInterface; |
| 7 | use ReflectionType; |
| 8 | |
| 9 | /** |
| 10 | * @implements ConverterInterface<?int, AutoIncrementTableInterface> |
| 11 | */ |
| 12 | class IntToAutoIncrementTable implements ConverterInterface |
| 13 | { |
| 14 | public function convert(?int $input, ?ReflectionType $wantedType): AutoIncrementTableInterface |
| 15 | { |
| 16 | $class = ConverterUtils::toReflectionClass($wantedType); |
| 17 | assert($class !== null); |
| 18 | $instance = $class->newInstanceWithoutConstructor(); |
| 19 | $instance->id = $input; |
| 20 | return $instance; |
| 21 | } |
| 22 | } |