|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class CoC_LogEntry |
|
4
|
|
|
{ |
|
5
|
|
|
protected $logEntry; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Constructor of CoC_Warlog |
|
9
|
|
|
* |
|
10
|
|
|
* @logEntry $logEntry, obtained by Warlog.class.php |
|
11
|
|
|
*/ |
|
12
|
|
|
public function __construct($logEntry) |
|
13
|
|
|
{ |
|
14
|
|
|
$this->logEntry = $logEntry; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
protected function getLogEntry() |
|
18
|
|
|
{ |
|
19
|
|
|
return $this->logEntry; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function getResult() |
|
23
|
|
|
{ |
|
24
|
|
|
return $this->getLogEntry()->result; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function getEndTime() |
|
28
|
|
|
{ |
|
29
|
|
|
return $this->getLogEntry()->endTime; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function getTeamSize() |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->getLogEntry()->teamSize(); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function getClanTag() |
|
38
|
|
|
{ |
|
39
|
|
|
return $this->getLogEntry()->clan->tag; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function getClanName() |
|
43
|
|
|
{ |
|
44
|
|
|
return $this->getLogEntry()->clan->name; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
View Code Duplication |
public function getClanBadeUrl($size = "") |
|
|
|
|
|
|
48
|
|
|
{ |
|
49
|
|
|
switch ($size) |
|
50
|
|
|
{ |
|
51
|
|
|
case "small": |
|
52
|
|
|
return $this->getLogEntry()->clan->badgeUrls->small; |
|
53
|
|
|
break; |
|
|
|
|
|
|
54
|
|
|
case "medium": |
|
55
|
|
|
return $this->getLogEntry()->clan->badgeUrls->medium; |
|
56
|
|
|
break; |
|
|
|
|
|
|
57
|
|
|
case "large": |
|
58
|
|
|
return $this->getLogEntry()->clan->badgeUrls->large; |
|
59
|
|
|
break; |
|
|
|
|
|
|
60
|
|
|
default: |
|
61
|
|
|
return $this->getLogEntry()->clan->badgeUrls->large; //return the largest because it can be resized using HTML |
|
62
|
|
|
break; |
|
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function getClanLevel() |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->getLogEntry()->clan->clanLevel; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getClanAttacks() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->getLogEntry()->clan->attacks; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function getClanStars() |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->getLogEntry()->clan->stars; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function getDestructionPercentage() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->getLogEntry()->clan->destructionPercentage; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function getExpEarned() |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->getLogEntry()->clan->expEarned; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function getOpponentTag() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->getLogEntry()->opponent->tag; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getOpponentName() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->getLogEntry()->opponent->name; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
View Code Duplication |
public function getOpponentBadgeUrls($size = "") |
|
|
|
|
|
|
102
|
|
|
{ |
|
103
|
|
|
switch ($size) |
|
104
|
|
|
{ |
|
105
|
|
|
case "small": |
|
106
|
|
|
return $this->getLogEntry()->opponent->badgeUrls->small; |
|
107
|
|
|
break; |
|
|
|
|
|
|
108
|
|
|
case "medium": |
|
109
|
|
|
return $this->getLogEntry()->opponent->badgeUrls->medium; |
|
110
|
|
|
break; |
|
|
|
|
|
|
111
|
|
|
case "large": |
|
112
|
|
|
return $this->getLogEntry()->opponent->badgeUrls->large; |
|
113
|
|
|
break; |
|
|
|
|
|
|
114
|
|
|
default: |
|
115
|
|
|
return $this->getLogEntry()->opponent->badgeUrls->large; //return the largest because it can be resized using HTML |
|
116
|
|
|
break; |
|
|
|
|
|
|
117
|
|
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function getOpponentLevel() |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->getLogEntry()->opponent->clanLevel; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public function getOpponentStars() |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->getLogEntry()->opponent->stars; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function getOpponentDestructionPercentage() |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->getLogEntry()->opponent->destructionPercentage; |
|
133
|
|
|
} |
|
134
|
|
|
} |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.