| Conditions | 1 |
| Paths | 1 |
| Total Lines | 160 |
| Code Lines | 122 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 36 | public function calculateProvider(){ |
||
| 37 | return array( |
||
| 38 | array( |
||
| 39 | new Subject( |
||
| 40 | array( |
||
| 41 | "name" => "Mario", |
||
| 42 | "surname" => "Rossi", |
||
| 43 | "birthDate" => "1985-12-10", |
||
| 44 | "gender" => "M", |
||
| 45 | "belfioreCode" => "A562" |
||
| 46 | ) |
||
| 47 | ), |
||
| 48 | 0, |
||
| 49 | "RSSMRA85T10A562S" |
||
| 50 | ), |
||
| 51 | array( |
||
| 52 | new Subject( |
||
| 53 | array( |
||
| 54 | "name" => "Roberto", |
||
| 55 | "surname" => "Santini", |
||
| 56 | "birthDate" => "1963-05-08", |
||
| 57 | "gender" => "M", |
||
| 58 | "belfioreCode" => "H501" |
||
| 59 | ) |
||
| 60 | ), |
||
| 61 | 0, |
||
| 62 | "SNTRRT63E08H501T" |
||
| 63 | ), |
||
| 64 | array( |
||
| 65 | new Subject( |
||
| 66 | array( |
||
| 67 | "name" => "Maria", |
||
| 68 | "surname" => "Montessori", |
||
| 69 | "birthDate" => "1870-08-31", |
||
| 70 | "gender" => "F", |
||
| 71 | "belfioreCode" => "C615" |
||
| 72 | ) |
||
| 73 | ), |
||
| 74 | 0, |
||
| 75 | "MNTMRA70M71C615I" |
||
| 76 | ), |
||
| 77 | array( |
||
| 78 | new Subject( |
||
| 79 | array( |
||
| 80 | "name" => "Mario", |
||
| 81 | "surname" => "Rossi", |
||
| 82 | "birthDate" => new \DateTime('1985-12-10'), |
||
| 83 | "gender" => "M", |
||
| 84 | "belfioreCode" => "A562" |
||
| 85 | ) |
||
| 86 | ), |
||
| 87 | 0, |
||
| 88 | "RSSMRA85T10A562S" |
||
| 89 | ), |
||
| 90 | array( |
||
| 91 | new Subject( |
||
| 92 | array( |
||
| 93 | "name" => "Gianfranco", |
||
| 94 | "surname" => "Rossi", |
||
| 95 | "birthDate" => "1985-12-10", |
||
| 96 | "gender" => "M", |
||
| 97 | "belfioreCode" => "A562" |
||
| 98 | ) |
||
| 99 | ), |
||
| 100 | 0, |
||
| 101 | "RSSGFR85T10A562I" |
||
| 102 | ), |
||
| 103 | array( |
||
| 104 | new Subject( |
||
| 105 | array( |
||
| 106 | "name" => "Mario", |
||
| 107 | "surname" => "Fo", |
||
| 108 | "birthDate" => "1985-12-10", |
||
| 109 | "gender" => "M", |
||
| 110 | "belfioreCode" => "A562" |
||
| 111 | ) |
||
| 112 | ), |
||
| 113 | 0, |
||
| 114 | "FOXMRA85T10A562G" |
||
| 115 | ), |
||
| 116 | array( |
||
| 117 | new Subject( |
||
| 118 | array( |
||
| 119 | "name" => "", |
||
| 120 | "surname" => "Rossi", |
||
| 121 | "birthDate" => "1985-12-10", |
||
| 122 | "gender" => "M", |
||
| 123 | "belfioreCode" => "A562" |
||
| 124 | ) |
||
| 125 | ), |
||
| 126 | 0, |
||
| 127 | "RSSXXX85T10A562R" |
||
| 128 | ), |
||
| 129 | array( |
||
| 130 | new Subject( |
||
| 131 | array( |
||
| 132 | "name" => "Mario", |
||
| 133 | "surname" => "", |
||
| 134 | "birthDate" => "1985-12-10", |
||
| 135 | "gender" => "M", |
||
| 136 | "belfioreCode" => "A562" |
||
| 137 | ) |
||
| 138 | ), |
||
| 139 | 0, |
||
| 140 | "XXXMRA85T10A562B" |
||
| 141 | ), |
||
| 142 | array( |
||
| 143 | new Subject( |
||
| 144 | array( |
||
| 145 | "name" => "", |
||
| 146 | "surname" => "", |
||
| 147 | "birthDate" => "1985-12-10", |
||
| 148 | "gender" => "M", |
||
| 149 | "belfioreCode" => "A562" |
||
| 150 | ) |
||
| 151 | ), |
||
| 152 | 0, |
||
| 153 | "XXXXXX85T10A562A" |
||
| 154 | ), |
||
| 155 | array( |
||
| 156 | new Subject( |
||
| 157 | array( |
||
| 158 | "name" => "Roberto", |
||
| 159 | "surname" => "Santi", |
||
| 160 | "birthDate" => "1963-05-08", |
||
| 161 | "gender" => "M", |
||
| 162 | "belfioreCode" => "H501" |
||
| 163 | ) |
||
| 164 | ), |
||
| 165 | 1, |
||
| 166 | "SNTRRT63E08H50ML" |
||
| 167 | ), |
||
| 168 | array( |
||
| 169 | new Subject( |
||
| 170 | array( |
||
| 171 | "name" => "Mario", |
||
| 172 | "surname" => "Rossi", |
||
| 173 | "birthDate" => "1985-12-10", |
||
| 174 | "gender" => "M", |
||
| 175 | "belfioreCode" => "A562" |
||
| 176 | ) |
||
| 177 | ), |
||
| 178 | 1, |
||
| 179 | "RSSMRA85T10A56NH" |
||
| 180 | ), |
||
| 181 | array( |
||
| 182 | new Subject( |
||
| 183 | array( |
||
| 184 | "name" => "Mario", |
||
| 185 | "surname" => "Rossi", |
||
| 186 | "birthDate" => "1985-12-10", |
||
| 187 | "gender" => "M", |
||
| 188 | "belfioreCode" => "A562" |
||
| 189 | ) |
||
| 190 | ), |
||
| 191 | 3, |
||
| 192 | "RSSMRA85T10ARSNO" |
||
| 193 | ) |
||
| 194 | ); |
||
| 195 | } |
||
| 196 | |||
| 247 |