Code Duplication    Length = 49-49 lines in 2 locations

src/Vehicle/Domain/Input/CarInput.php 1 location

@@ 9-57 (lines=49) @@
6
use App\Vehicle\Domain\VehicleAbstract;
7
use Overblog\GraphQLBundle\Definition\Argument;
8
9
class CarInput extends VehicleAbstract
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $id;
15
16
    /**
17
     * @var int
18
     */
19
    protected $seatsNumber;
20
21
    /**
22
     * @param string $id
23
     * @param string $manufacturer
24
     * @param string $model
25
     * @param int $seatsNumber
26
     */
27
    public function __construct(string $id, string $manufacturer, string $model, int $seatsNumber)
28
    {
29
        parent::__construct($id, $manufacturer, $model);
30
31
        $this->seatsNumber = $seatsNumber;
32
    }
33
34
    /**
35
     * @return int
36
     */
37
    public function getSeatsNumber(): int
38
    {
39
        return $this->seatsNumber;
40
    }
41
42
    /**
43
     * @param Argument $argument
44
     * @return CarInput
45
     */
46
    public static function createFromArgument(Argument $argument): CarInput
47
    {
48
        $input = $argument->offsetGet('input');
49
50
        return new self(
51
            AppGlobalId::getIdFromGlobalId($input['id']),
52
            $input['manufacturer'],
53
            $input['model'],
54
            $input['seats_number']
55
        );
56
    }
57
}
58

src/Vehicle/Domain/Input/TruckInput.php 1 location

@@ 9-57 (lines=49) @@
6
use App\Vehicle\Domain\VehicleAbstract;
7
use Overblog\GraphQLBundle\Definition\Argument;
8
9
class TruckInput extends VehicleAbstract
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $id;
15
16
    /**
17
     * @var int
18
     */
19
    protected $maximumLoad;
20
21
    /**
22
     * @param string $id
23
     * @param string $manufacturer
24
     * @param string $model
25
     * @param int $maximumLoad
26
     */
27
    public function __construct(string $id, string $manufacturer, string $model, int $maximumLoad)
28
    {
29
        parent::__construct($id, $manufacturer, $model);
30
31
        $this->maximumLoad = $maximumLoad;
32
    }
33
34
    /**
35
     * @return int
36
     */
37
    public function getMaximumLoad(): int
38
    {
39
        return $this->maximumLoad;
40
    }
41
42
    /**
43
     * @param Argument $argument
44
     * @return TruckInput
45
     */
46
    public static function createFromArgument(Argument $argument): TruckInput
47
    {
48
        $input = $argument->offsetGet('input');
49
50
        return new self(
51
            AppGlobalId::getIdFromGlobalId($input['id']),
52
            $input['manufacturer'],
53
            $input['model'],
54
            $input['maximum_load']
55
        );
56
    }
57
}
58