Code Duplication    Length = 33-35 lines in 8 locations

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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