Code Duplication    Length = 30-30 lines in 6 locations

src/PtrTn/Battlerite/Dto/Match/Asset.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Webmozart\Assert\Assert;
6
7
class Asset
8
{
9
    /**
10
     * @var string
11
     */
12
    public $type;
13
    /**
14
     * @var string
15
     */
16
    public $id;
17
18
    private function __construct(
19
        string $type,
20
        string $id
21
    ) {
22
        $this->type = $type;
23
        $this->id = $id;
24
    }
25
26
    public static function createFromArray(array $asset): self
27
    {
28
        Assert::string($asset['type']);
29
        Assert::string($asset['id']);
30
31
        return new self(
32
            $asset['type'],
33
            $asset['id']
34
        );
35
    }
36
}
37

src/PtrTn/Battlerite/Dto/Match/Map.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Webmozart\Assert\Assert;
6
7
class Map
8
{
9
    /**
10
     * @var string
11
     */
12
    public $mapId;
13
    /**
14
     * @var string
15
     */
16
    public $type;
17
18
    public function __construct(
19
        string $mapId,
20
        string $type
21
    ) {
22
        $this->mapId = $mapId;
23
        $this->type = $type;
24
    }
25
26
    public static function createFromArray(array $stats): self
27
    {
28
        Assert::string($stats['mapID']);
29
        Assert::string($stats['type']);
30
31
        return new self(
32
            $stats['mapID'],
33
            $stats['type']
34
        );
35
    }
36
}
37

src/PtrTn/Battlerite/Dto/Matches/Asset.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Webmozart\Assert\Assert;
6
7
class Asset
8
{
9
    /**
10
     * @var string
11
     */
12
    public $type;
13
    /**
14
     * @var string
15
     */
16
    public $id;
17
18
    private function __construct(
19
        string $type,
20
        string $id
21
    ) {
22
        $this->type = $type;
23
        $this->id = $id;
24
    }
25
26
    public static function createFromArray(array $asset): self
27
    {
28
        Assert::string($asset['type']);
29
        Assert::string($asset['id']);
30
31
        return new self(
32
            $asset['type'],
33
            $asset['id']
34
        );
35
    }
36
}
37

src/PtrTn/Battlerite/Dto/Matches/Map.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Webmozart\Assert\Assert;
6
7
class Map
8
{
9
    /**
10
     * @var string
11
     */
12
    public $mapId;
13
    /**
14
     * @var string
15
     */
16
    public $type;
17
18
    public function __construct(
19
        string $mapId,
20
        string $type
21
    ) {
22
        $this->mapId = $mapId;
23
        $this->type = $type;
24
    }
25
26
    public static function createFromArray(array $stats): self
27
    {
28
        Assert::string($stats['mapID']);
29
        Assert::string($stats['type']);
30
31
        return new self(
32
            $stats['mapID'],
33
            $stats['type']
34
        );
35
    }
36
}
37

src/PtrTn/Battlerite/Dto/Matches/Roster.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Webmozart\Assert\Assert;
6
7
class Roster
8
{
9
    /**
10
     * @var string
11
     */
12
    public $type;
13
    /**
14
     * @var string
15
     */
16
    public $id;
17
18
    private function __construct(
19
        string $type,
20
        string $id
21
    ) {
22
        $this->type = $type;
23
        $this->id = $id;
24
    }
25
26
    public static function createFromArray(array $roster): self
27
    {
28
        Assert::string($roster['type']);
29
        Assert::string($roster['id']);
30
31
        return new self(
32
            $roster['type'],
33
            $roster['id']
34
        );
35
    }
36
}
37

src/PtrTn/Battlerite/Dto/Matches/Round.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Webmozart\Assert\Assert;
6
7
class Round
8
{
9
    /**
10
     * @var string
11
     */
12
    public $type;
13
    /**
14
     * @var string
15
     */
16
    public $id;
17
18
    private function __construct(
19
        string $type,
20
        string $id
21
    ) {
22
        $this->type = $type;
23
        $this->id = $id;
24
    }
25
26
    public static function createFromArray(array $round): self
27
    {
28
        Assert::string($round['type']);
29
        Assert::string($round['id']);
30
31
        return new self(
32
            $round['type'],
33
            $round['id']
34
        );
35
    }
36
}
37