Code Duplication    Length = 31-32 lines in 12 locations

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Assets extends CollectionDto
11
{
12
    /**
13
     * @var Asset[]
14
     */
15
    public $items;
16
17
    protected function __construct(array $assets)
18
    {
19
        parent::__construct(Asset::class, $assets);
20
    }
21
22
    public static function createFromArray(array $assets): self
23
    {
24
        Assert::notNull($assets);
25
26
        $createdAssets = [];
27
        foreach ($assets as $asset) {
28
            $createdAssets[] = Asset::createFromArray($asset);
29
        }
30
        return new self($createdAssets);
31
    }
32
33
    /**
34
     * @return Traversable|Asset[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Participants extends CollectionDto
11
{
12
    /**
13
     * @var Participant[]
14
     */
15
    public $items;
16
17
    public function __construct(array $participants)
18
    {
19
        parent::__construct(Participant::class, $participants);
20
    }
21
22
    public static function createFromArray(array $participants): self
23
    {
24
        Assert::notNull($participants);
25
26
        $createdParticipants = [];
27
        foreach ($participants as $participant) {
28
            $createdParticipants[] = Participant::createFromArray($participant);
29
        }
30
        return new self($createdParticipants);
31
    }
32
33
    /**
34
     * @return Traversable|Participant[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Players extends CollectionDto
11
{
12
    /**
13
     * @var Player[]
14
     */
15
    public $items;
16
17
    public function __construct(array $players)
18
    {
19
        parent::__construct(Player::class, $players);
20
    }
21
22
    public static function createFromArray(array $players): self
23
    {
24
        Assert::notNull($players);
25
26
        $createdPlayers = [];
27
        foreach ($players as $player) {
28
            $createdPlayers[] = Player::createFromArray($player);
29
        }
30
        return new self($createdPlayers);
31
    }
32
33
    /**
34
     * @return Traversable|Player[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Rounds extends CollectionDto
11
{
12
    /**
13
     * @var Round[]
14
     */
15
    public $items;
16
17
    public function __construct(array $rounds)
18
    {
19
        parent::__construct(Round::class, $rounds);
20
    }
21
22
    public static function createFromArray(array $rounds): self
23
    {
24
        Assert::notNull($rounds);
25
26
        $createdRounds = [];
27
        foreach ($rounds as $round) {
28
            $createdRounds[] = Round::createFromArray($round);
29
        }
30
        return new self($createdRounds);
31
    }
32
33
    /**
34
     * @return Traversable|Round[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Spectators extends CollectionDto
11
{
12
    /**
13
     * @var Spectator[]
14
     */
15
    public $items;
16
17
    protected function __construct(array $spectators)
18
    {
19
        parent::__construct(Spectator::class, $spectators);
20
    }
21
22
    public static function createFromArray(array $spectators): self
23
    {
24
        Assert::notNull($spectators);
25
26
        $createdSpectators = [];
27
        foreach ($spectators as $spectator) {
28
            $createdSpectators[] = Spectator::createFromArray($spectator);
29
        }
30
        return new self($createdSpectators);
31
    }
32
33
    /**
34
     * @return Traversable|Spectator[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Assets extends CollectionDto
11
{
12
    /**
13
     * @var Asset[]
14
     */
15
    public $items;
16
17
    protected function __construct(array $assets)
18
    {
19
        parent::__construct(Asset::class, $assets);
20
    }
21
22
    public static function createFromArray(array $assets): self
23
    {
24
        Assert::notNull($assets);
25
26
        $createdAssets = [];
27
        foreach ($assets as $asset) {
28
            $createdAssets[] = Asset::createFromArray($asset);
29
        }
30
        return new self($createdAssets);
31
    }
32
33
    /**
34
     * @return Traversable|Asset[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Matches extends CollectionDto
11
{
12
    /**
13
     * @var Match[]
14
     */
15
    public $items;
16
17
    protected function __construct(array $matches)
18
    {
19
        parent::__construct(Match::class, $matches);
20
    }
21
22
    public static function createFromArray(array $matches): self
23
    {
24
        Assert::notNull($matches);
25
26
        $createdMatches = [];
27
        foreach ($matches as $match) {
28
            $createdMatches[] = Match::createFromArray($match);
29
        }
30
        return new self($createdMatches);
31
    }
32
33
    /**
34
     * @return Traversable|Match[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Rosters extends CollectionDto
11
{
12
    /**
13
     * @var Roster[]
14
     */
15
    public $items;
16
17
    protected function __construct(array $rosters)
18
    {
19
        parent::__construct(Roster::class, $rosters);
20
    }
21
22
    public static function createFromArray(array $rosters): self
23
    {
24
        Assert::notNull($rosters);
25
26
        $createdRosters = [];
27
        foreach ($rosters as $roster) {
28
            $createdRosters[] = Roster::createFromArray($roster);
29
        }
30
        return new self($createdRosters);
31
    }
32
33
    /**
34
     * @return Traversable|Roster[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Rounds extends CollectionDto
11
{
12
    /**
13
     * @var Round[]
14
     */
15
    public $items;
16
17
    protected function __construct(array $rounds)
18
    {
19
        parent::__construct(Round::class, $rounds);
20
    }
21
22
    public static function createFromArray(array $rounds): self
23
    {
24
        Assert::notNull($rounds);
25
26
        $createdRounds = [];
27
        foreach ($rounds as $round) {
28
            $createdRounds[] = Round::createFromArray($round);
29
        }
30
        return new self($createdRounds);
31
    }
32
33
    /**
34
     * @return Traversable|Round[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

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

@@ 10-40 (lines=31) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Spectators extends CollectionDto
11
{
12
    /**
13
     * @var Spectator[]
14
     */
15
    public $items;
16
17
    protected function __construct(array $spectators)
18
    {
19
        parent::__construct(Spectator::class, $spectators);
20
    }
21
22
    public static function createFromArray(array $spectators): self
23
    {
24
        Assert::notNull($spectators);
25
26
        $createdSpectators = [];
27
        foreach ($spectators as $spectator) {
28
            $createdSpectators[] = Spectator::createFromArray($spectator);
29
        }
30
        return new self($createdSpectators);
31
    }
32
33
    /**
34
     * @return Traversable|Spectator[]
35
     */
36
    public function getIterator(): Traversable
37
    {
38
        return new ArrayIterator($this->items);
39
    }
40
}
41

src/PtrTn/Battlerite/Dto/Player/Champions.php 1 location

@@ 10-41 (lines=32) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Champions extends CollectionDto
11
{
12
    /**
13
     * @var Champion[]
14
     */
15
    public $items;
16
17
18
    protected function __construct(array $assets)
19
    {
20
        parent::__construct(Champion::class, $assets);
21
    }
22
23
    public static function createFromArray(array $championStats): self
24
    {
25
        Assert::notNull($championStats);
26
27
        $createdAssets = [];
28
        foreach ($championStats as $championName => $champion) {
29
            $createdAssets[] = Champion::createFromArray($championName, $champion);
30
        }
31
        return new self($createdAssets);
32
    }
33
34
    /**
35
     * @return Traversable|Champion[]
36
     */
37
    public function getIterator(): Traversable
38
    {
39
        return new ArrayIterator($this->items);
40
    }
41
}
42

src/PtrTn/Battlerite/Dto/Player/Maps.php 1 location

@@ 10-41 (lines=32) @@
7
use Traversable;
8
use Webmozart\Assert\Assert;
9
10
class Maps extends CollectionDto
11
{
12
    /**
13
     * @var Map[]
14
     */
15
    public $items;
16
17
18
    protected function __construct(array $assets)
19
    {
20
        parent::__construct(Map::class, $assets);
21
    }
22
23
    public static function createFromArray(array $mapStats): self
24
    {
25
        Assert::notNull($mapStats);
26
27
        $createdAssets = [];
28
        foreach ($mapStats as $mapName => $map) {
29
            $createdAssets[] = Map::createFromArray($mapName, $map);
30
        }
31
        return new self($createdAssets);
32
    }
33
34
    /**
35
     * @return Traversable|Map[]
36
     */
37
    public function getIterator(): Traversable
38
    {
39
        return new ArrayIterator($this->items);
40
    }
41
}
42