|
1
|
|
|
<?php |
|
2
|
|
|
namespace Perry\Representation\Eve\v1; |
|
3
|
|
|
|
|
4
|
|
|
use \Perry\Representation\Reference as Reference; |
|
5
|
|
|
use \Perry\Representation\Uri as Uri; |
|
6
|
|
|
use \Perry\Representation\Base as Base; |
|
7
|
|
|
|
|
8
|
|
|
class TournamentSeriesCollection extends Base |
|
9
|
|
|
{ |
|
10
|
|
|
public $pageCount; |
|
11
|
|
|
|
|
12
|
|
|
public $items = []; |
|
13
|
|
|
|
|
14
|
|
|
public $totalCount; |
|
15
|
|
|
|
|
16
|
|
|
public $next; |
|
17
|
|
|
|
|
18
|
|
|
public $previous; |
|
19
|
|
|
|
|
20
|
|
|
// by Warringer\Types\Long |
|
21
|
|
|
public function setPageCount($pageCount) |
|
22
|
|
|
{ |
|
23
|
|
|
$this->pageCount = $pageCount; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
// by Warringer\Types\ArrayType |
|
27
|
|
|
public function setItems($items) |
|
28
|
|
|
{ |
|
29
|
|
|
// by Warringer\Types\Base |
|
30
|
|
|
$converters = []; |
|
31
|
|
|
$converters['matchesInProgress'] = function ($values) { |
|
32
|
|
|
// by Warringer\Types\Reference |
|
33
|
|
|
$func = function ($value) { return new Reference($value); }; |
|
34
|
|
|
|
|
35
|
|
|
foreach ($values as $key => $value) { |
|
36
|
|
|
$values[$key] = $func($value); |
|
37
|
|
|
} |
|
38
|
|
|
return $values; |
|
39
|
|
|
}; |
|
40
|
|
|
|
|
41
|
|
|
$converters['redTeam'] = function ($value) { return $value; }; |
|
42
|
|
|
$converters['matchesWon'] = function ($value) { return $value; }; |
|
43
|
|
|
$converters['matches'] = function ($value) { return new Reference($value); }; |
|
44
|
|
|
$converters['self'] = function ($value) { return new Reference($value); }; |
|
45
|
|
|
$converters['winner'] = function ($value) { return $value; }; |
|
46
|
|
|
$converters['loser'] = function ($value) { return $value; }; |
|
47
|
|
|
$converters['length'] = function ($value) { return $value; }; |
|
48
|
|
|
$converters['blueTeam'] = function ($value) { return $value; }; |
|
49
|
|
|
$converters['structure'] = function ($value) { return $value; }; |
|
50
|
|
|
|
|
51
|
|
|
$func = function ($value) use($converters) { |
|
52
|
|
|
$return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS); |
|
53
|
|
|
$return['matchesInProgress'] = isset($value->{'matchesInProgress'}) ? $converters['matchesInProgress']($value->{'matchesInProgress'}) : null; |
|
54
|
|
|
$return['redTeam'] = isset($value->{'redTeam'}) ? $converters['redTeam']($value->{'redTeam'}) : null; |
|
55
|
|
|
$return['matchesWon'] = isset($value->{'matchesWon'}) ? $converters['matchesWon']($value->{'matchesWon'}) : null; |
|
56
|
|
|
$return['matches'] = isset($value->{'matches'}) ? $converters['matches']($value->{'matches'}) : null; |
|
57
|
|
|
$return['self'] = isset($value->{'self'}) ? $converters['self']($value->{'self'}) : null; |
|
58
|
|
|
$return['winner'] = isset($value->{'winner'}) ? $converters['winner']($value->{'winner'}) : null; |
|
59
|
|
|
$return['loser'] = isset($value->{'loser'}) ? $converters['loser']($value->{'loser'}) : null; |
|
60
|
|
|
$return['length'] = isset($value->{'length'}) ? $converters['length']($value->{'length'}) : null; |
|
61
|
|
|
$return['blueTeam'] = isset($value->{'blueTeam'}) ? $converters['blueTeam']($value->{'blueTeam'}) : null; |
|
62
|
|
|
$return['structure'] = isset($value->{'structure'}) ? $converters['structure']($value->{'structure'}) : null; |
|
63
|
|
|
return $return; |
|
64
|
|
|
}; |
|
65
|
|
|
|
|
66
|
|
|
foreach ($items as $key => $value) { |
|
67
|
|
|
$this->items[$key] = $func($value); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
// by Warringer\Types\Long |
|
72
|
|
|
public function setTotalCount($totalCount) |
|
73
|
|
|
{ |
|
74
|
|
|
$this->totalCount = $totalCount; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
// by Warringer\Types\Reference |
|
78
|
|
|
public function setNext($next) |
|
79
|
|
|
{ |
|
80
|
|
|
$this->next = new Reference($next); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
// by Warringer\Types\Reference |
|
84
|
|
|
public function setPrevious($previous) |
|
85
|
|
|
{ |
|
86
|
|
|
$this->previous = new Reference($previous); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
} |
|
90
|
|
|
|