1n9i9c7om /
ClashOfClans-API-PHP
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | class CoC_Player |
||
| 3 | {
|
||
| 4 | protected $api; |
||
| 5 | protected $tag; |
||
| 6 | protected $player = NULL; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Constructor of CoC_Clan |
||
| 10 | * Either pass the clan tag or a stdClass containing all clan information. |
||
| 11 | */ |
||
| 12 | public function __construct($tag) |
||
| 13 | {
|
||
| 14 | $this->api = new ClashOfClans(); |
||
| 15 | $this->tag = $tag; |
||
| 16 | $this->getPlayer(); |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Sending requests over through API.class.php; |
||
| 21 | */ |
||
| 22 | protected function getPlayer() |
||
| 23 | {
|
||
| 24 | if($this->player == NULL) |
||
| 25 | {
|
||
| 26 | $this->player = $this->api->getPlayer($this->tag); |
||
| 27 | } |
||
| 28 | return $this->player; |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Getting current player tag. |
||
| 33 | * |
||
| 34 | * @return string, tag |
||
|
0 ignored issues
–
show
|
|||
| 35 | */ |
||
| 36 | public function getTag() |
||
| 37 | {
|
||
| 38 | return $this->player->tag; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Getting current player name. |
||
| 43 | * |
||
| 44 | * @return string, name |
||
|
0 ignored issues
–
show
The doc-type
string, could not be parsed: Expected "|" or "end of type", but got "," at position 6. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 45 | */ |
||
| 46 | public function getName() |
||
| 47 | {
|
||
| 48 | return $this->player->name; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Getting current player townhall level. |
||
| 53 | * |
||
| 54 | * @return int, townhallLevel |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 55 | */ |
||
| 56 | public function getTownhallLevel() |
||
| 57 | {
|
||
| 58 | return $this->player->townhallLevel; |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Getting current player's experience level. |
||
| 63 | * |
||
| 64 | * @return int, expLevel |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 65 | */ |
||
| 66 | public function getExp() |
||
| 67 | {
|
||
| 68 | return $this->player->expLevel; |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Getting current player's trophy. |
||
| 73 | * |
||
| 74 | * @return int, trophy |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 75 | */ |
||
| 76 | public function getTrophies() |
||
| 77 | {
|
||
| 78 | return $this->player->trophies; |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Getting current player's highest trophy count. |
||
| 83 | * |
||
| 84 | * @return int, highestTrophy |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 85 | */ |
||
| 86 | public function getBestTrophies() |
||
| 87 | {
|
||
| 88 | return $this->player->bestTrophies; |
||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Getting current player's war stars. |
||
| 93 | * |
||
| 94 | * @return int, warStars |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 95 | */ |
||
| 96 | public function getWarStars() |
||
| 97 | {
|
||
| 98 | return $this->player->warStars; |
||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * Getting current player's defense/attack wins. |
||
| 103 | * |
||
| 104 | * @return int, attackWins/defenseWins |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 105 | */ |
||
| 106 | public function getWins($attack = true) |
||
| 107 | {
|
||
| 108 | if ($attack == true) |
||
|
0 ignored issues
–
show
|
|||
| 109 | {
|
||
| 110 | return $this->player->attackWins; |
||
| 111 | } |
||
| 112 | else |
||
| 113 | {
|
||
| 114 | return $this->player->defenseWins; |
||
| 115 | } |
||
| 116 | } |
||
| 117 | |||
| 118 | /** |
||
| 119 | * Getting current player's role. |
||
| 120 | * |
||
| 121 | * @return string, role |
||
|
0 ignored issues
–
show
The doc-type
string, could not be parsed: Expected "|" or "end of type", but got "," at position 6. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 122 | */ |
||
| 123 | public function getRole() |
||
| 124 | {
|
||
| 125 | return $this->player->role; |
||
| 126 | } |
||
| 127 | |||
| 128 | /** |
||
| 129 | * Getting current player's donations. |
||
| 130 | * |
||
| 131 | * @return int, donations |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 132 | */ |
||
| 133 | public function getDonations() |
||
| 134 | {
|
||
| 135 | return $this->player->donations; |
||
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
| 139 | * Getting current player's donations received. |
||
| 140 | * |
||
| 141 | * @return int, donationsReceived |
||
|
0 ignored issues
–
show
The doc-type
int, could not be parsed: Expected "|" or "end of type", but got "," at position 3. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 142 | */ |
||
| 143 | public function getDonationsReceived() |
||
| 144 | {
|
||
| 145 | return $this->player->donationsReceived; |
||
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * Getting player's clan details. |
||
| 150 | * |
||
| 151 | * @param string, detail (tag, badgeUrls, name, clanLevel) |
||
| 152 | */ |
||
| 153 | public function getPlayerClan($detail = "tag") |
||
| 154 | {
|
||
| 155 | return $this->player->clan->$detail; |
||
| 156 | } |
||
| 157 | |||
| 158 | /** |
||
| 159 | * Getting player's league details. |
||
| 160 | * |
||
| 161 | * @param string, detail (id, name, iconUrls[small, tiny, medium]) |
||
| 162 | */ |
||
| 163 | public function getLeague($detail = "name") |
||
| 164 | {
|
||
| 165 | return $this->player->league->$detail; |
||
| 166 | } |
||
| 167 | |||
| 168 | /** |
||
| 169 | * Getting player's achievements by index. |
||
| 170 | * |
||
| 171 | * @param int, achievements |
||
| 172 | */ |
||
| 173 | public function getAchievements($achievement = 0) |
||
| 174 | {
|
||
| 175 | return $this->player->achievements[$achievement]; |
||
| 176 | } |
||
| 177 | |||
| 178 | /** |
||
| 179 | * Getting player's troops detail by index. |
||
| 180 | * |
||
| 181 | * @param int, troop (index) |
||
| 182 | */ |
||
| 183 | public function getTroops($troop = 0) |
||
| 184 | {
|
||
| 185 | return $this->player->troops[$troop]; |
||
| 186 | } |
||
| 187 | |||
| 188 | /** |
||
| 189 | * Getting player's spells detail by index. |
||
| 190 | * |
||
| 191 | * @param int, spell (index) |
||
| 192 | */ |
||
| 193 | public function getSpells($spell = 0) |
||
| 194 | {
|
||
| 195 | return $this->player->spells[$spell]; |
||
| 196 | } |
||
| 197 | } |
||
| 198 | ?> |
||
|
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. Loading history...
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.