Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
IntToAutoIncrementTable
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 convert
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\StorageMetadata\Converters;
3
4use Apie\Core\Utils\ConverterUtils;
5use Apie\StorageMetadata\Interfaces\AutoIncrementTableInterface;
6use Apie\TypeConverter\ConverterInterface;
7use ReflectionType;
8
9/**
10 * @implements ConverterInterface<?int, AutoIncrementTableInterface>
11 */
12class 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}