Conditions | 1 |
Paths | 1 |
Total Lines | 99 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
42 | public function providerEloChanges() |
||
43 | { |
||
44 | return [ |
||
45 | [false, Result::TEAM_A_WINS, [ |
||
46 | ["points" => 1501.0, "rated" => 53, "played" => 74, "ranked" => 102, "pointChange" => 0.0, |
||
47 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
48 | ["points" => 1300.0, "rated" => 20, "played" => 32, "ranked" => 26, "pointChange" => 0.0, |
||
49 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
50 | ["points" => 1450.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => 0.0, |
||
51 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
52 | ["points" => 1200.0, "rated" => 60, "played" => 70, "ranked" => 75, "pointChange" => 0.0, |
||
53 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
54 | ]], |
||
55 | [true, Result::TEAM_A_WINS, [ |
||
56 | ["points" => 1501.0, "rated" => 53, "played" => 74, "ranked" => 102, "pointChange" => 7.8605068927035, |
||
57 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
58 | ["points" => 1300.0, "rated" => 20, "played" => 32, "ranked" => 26, "pointChange" => 7.8605068927035, |
||
59 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
60 | ["points" => 1450.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => -7.8605068927035, |
||
61 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
62 | ["points" => 1200.0, "rated" => 60, "played" => 70, "ranked" => 75, "pointChange" => 0.0, |
||
63 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
64 | ]], |
||
65 | [true, Result::TEAM_B_WINS, [ |
||
66 | ["points" => 1501.0, "rated" => 53, "played" => 74, "ranked" => 102, "pointChange" => -12.139493107296, |
||
67 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
68 | ["points" => 1300.0, "rated" => 20, "played" => 32, "ranked" => 26, "pointChange" => -12.139493107296, |
||
69 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
70 | ["points" => 1450.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => 12.139493107296, |
||
71 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
72 | ["points" => 1200.0, "rated" => 60, "played" => 70, "ranked" => 75, "pointChange" => 12.139493107296, |
||
73 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
74 | ]], |
||
75 | [true, Result::DRAW, [ |
||
76 | ["points" => 1501.0, "rated" => 53, "played" => 74, "ranked" => 102, "pointChange" => -2.1394931072965, |
||
77 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
78 | ["points" => 1300.0, "rated" => 20, "played" => 32, "ranked" => 26, "pointChange" => -2.1394931072965, |
||
79 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
80 | ["points" => 1450.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => 2.1394931072965, |
||
81 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
82 | ["points" => 1200.0, "rated" => 60, "played" => 70, "ranked" => 75, "pointChange" => 2.1394931072965, |
||
83 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
84 | ]], |
||
85 | [true, Result::NULLED, [ |
||
86 | ["points" => 1501.0, "rated" => 53, "played" => 74, "ranked" => 102, "pointChange" => 0.0, |
||
87 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
88 | ["points" => 1300.0, "rated" => 20, "played" => 32, "ranked" => 26, "pointChange" => 0.0, |
||
89 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
90 | ["points" => 1450.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => 0.0, |
||
91 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
92 | ["points" => 1200.0, "rated" => 60, "played" => 70, "ranked" => 75, "pointChange" => 0.0, |
||
93 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
94 | ]], |
||
95 | [true, Result::NOT_YET_FINISHED, [ |
||
96 | ["points" => 1501.0, "rated" => 53, "played" => 74, "ranked" => 102, "pointChange" => 0.0, |
||
97 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
98 | ["points" => 1300.0, "rated" => 20, "played" => 32, "ranked" => 26, "pointChange" => 0.0, |
||
99 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
100 | ["points" => 1450.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => 0.0, |
||
101 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
102 | ["points" => 1200.0, "rated" => 60, "played" => 70, "ranked" => 75, "pointChange" => 0.0, |
||
103 | "ratedGamesChange" => 0, "playedChange" => 0], |
||
104 | ]], |
||
105 | [true, Result::TEAM_A_WINS, [ |
||
106 | ["points" => 0.0, "rated" => 15, "played" => 19, "ranked" => 20, "pointChange" => 1515.78125, |
||
107 | "ratedGamesChange" => 1, "playedChange" => 1, "provisoryRanking" => 1501.0, "provisoryChange" => 14.78125], |
||
108 | ["points" => 1300.0, "rated" => 20, "played" => 20, "ranked" => 26, "pointChange" => 0.0, |
||
109 | "ratedGamesChange" => 0, "playedChange" => 1], |
||
110 | ["points" => 1450.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => 0.0, |
||
111 | "ratedGamesChange" => 0, "playedChange" => 1], |
||
112 | ["points" => 0.0, "rated" => 10, "played" => 10, "ranked" => 15, "pointChange" => 0.0, |
||
113 | "ratedGamesChange" => 1, "playedChange" => 1, "provisoryRanking" => 1200.0, |
||
114 | "provisoryChange" => -20.386363636364], |
||
115 | ]], |
||
116 | [true, Result::TEAM_A_WINS, [ |
||
117 | ["points" => 0.0, "rated" => 15, "played" => 15, "ranked" => 20, "pointChange" => 0.0, |
||
118 | "ratedGamesChange" => 1, "playedChange" => 1, "provisoryRanking" => 1501.0, "provisoryChange" => 6.1875], |
||
119 | ["points" => 2000.0, "rated" => 20, "played" => 20, "ranked" => 26, "pointChange" => 0.0, |
||
120 | "ratedGamesChange" => 0, "playedChange" => 1], |
||
121 | ["points" => 1200.0, "rated" => 100, "played" => 100, "ranked" => 100, "pointChange" => 0.0, |
||
122 | "ratedGamesChange" => 0, "playedChange" => 1], |
||
123 | ["points" => 0.0, "rated" => 10, "played" => 10, "ranked" => 15, "pointChange" => 0.0, |
||
124 | "ratedGamesChange" => 1, "playedChange" => 1, "provisoryRanking" => 1200.0, |
||
125 | "provisoryChange" => 31.863636363636], |
||
126 | ]], |
||
127 | [true, Result::TEAM_A_WINS, [ |
||
128 | ["points" => 1501.0, "rated" => 53, "played" => 74, "ranked" => 102, "pointChange" => 4.7840781802172, |
||
129 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
130 | ["points" => 1300.0, "rated" => 20, "played" => 32, "ranked" => 26, "pointChange" => -4.7840781802172, |
||
131 | "ratedGamesChange" => 1, "playedChange" => 1], |
||
132 | ]], |
||
133 | [true, Result::TEAM_A_WINS, [ |
||
134 | ["points" => 0.0, "rated" => 15, "played" => 15, "ranked" => 20, "pointChange" => 0.0, |
||
135 | "ratedGamesChange" => 1, "playedChange" => 1, "provisoryRanking" => 1501.0, "provisoryChange" => 12.4375], |
||
136 | ["points" => 1300.0, "rated" => 20, "played" => 20, "ranked" => 26, "pointChange" => 0.0, |
||
137 | "ratedGamesChange" => 0, "playedChange" => 1], |
||
138 | ]], |
||
139 | ]; |
||
140 | } |
||
141 | |||
313 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: