Code Duplication    Length = 31-31 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/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
    public 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/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/Players/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
    protected 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