Total Complexity | 8 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait GetHtmlTopTrait |
||
6 | { |
||
7 | use GetHtmlTopGameTrait; |
||
8 | use GetHtmlTopPlayerTrait; |
||
9 | |||
10 | /** |
||
11 | * @param $row |
||
12 | * @param $nbGame |
||
13 | * @return string |
||
14 | */ |
||
15 | private function diff($row, $nbGame): string |
||
16 | { |
||
17 | if ($row['oldRank'] != null) { |
||
18 | if ($row['rank'] < $row['oldRank']) { |
||
19 | if ($row['oldRank'] > $nbGame) { |
||
20 | $col = '<span class="article-top--new"><abbr title="New">N</abbr></span>'; |
||
21 | } else { |
||
22 | $col = sprintf('<span class="article-top--up">+%d <span class="screen-reader-text">position</span></span>', $row['oldRank'] - $row['rank']); |
||
23 | } |
||
24 | } elseif ($row['rank'] > $row['oldRank']) { |
||
25 | $col = sprintf('<span class="article-top--down">-%d <span class="screen-reader-text">position</span></span>', $row['rank'] - $row['oldRank']); |
||
26 | } else { |
||
27 | $col = '<span class="article-top--equal"><abbr title="Same position">=</abbr></span>'; |
||
28 | } |
||
29 | } else { |
||
30 | $col = '<span class="article-top--new"><abbr title="New">N</abbr></span>'; |
||
31 | } |
||
32 | return $col; |
||
33 | } |
||
34 | |||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | private function getHtmLine(): string |
||
40 | { |
||
41 | return ' |
||
42 | <tr> |
||
43 | <td>%d</td> |
||
44 | <td> |
||
45 | <a href="%s">%s</a> |
||
46 | </td> |
||
47 | <td>%s posts</td> |
||
48 | <td> |
||
49 | %s |
||
50 | </td> |
||
51 | </tr>'; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | private function getHtmlBottom1(): string |
||
60 | <tr> |
||
61 | <td colspan="2" class="article-top__bottom-left">%d - %d</td> |
||
62 | <td colspan="2" class="article-top__bottom-right">%d posts</td> |
||
63 | </tr>'; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | private function getHtmlBottom2(): string |
||
72 | <tfooter> |
||
73 | <tr> |
||
74 | <th scope="row" colspan="2" class="article-top__bottom-left">Total</th> |
||
80 |