Complex classes like PatientPOR often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use PatientPOR, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 41 | class PatientPOR extends Patient { |
||
| 42 | |||
| 43 | /* |
||
| 44 | * I Ciąża; |
||
| 45 | * I Wywiad; |
||
| 46 | * I Pozycja; |
||
| 47 | * I Higiena; |
||
| 48 | * I Dieta; |
||
| 49 | * I Pomiar parametrów życiowych; |
||
| 50 | * I ASP; |
||
| 51 | * I Postęp porodu; |
||
| 52 | * I Wydalanie; |
||
| 53 | * I Pęcherz płodowy; |
||
| 54 | * I Ćwiczenia oddechowe; |
||
| 55 | * I Leki; |
||
| 56 | * I Edukacja zdrowotna i wsparcie psychiczne; |
||
| 57 | * II Czas; |
||
| 58 | * II Pozycja; |
||
| 59 | * II Czystość krocza; |
||
| 60 | * II Nacięcie; |
||
| 61 | * II Aktywność; |
||
| 62 | * II Higiena; |
||
| 63 | * II Dieta; |
||
| 64 | * II Pomiar parametrów życiowych; |
||
| 65 | * II ASP; |
||
| 66 | * II Wydalanie; |
||
| 67 | * II Leki; |
||
| 68 | * II Edukacja zdrowotna i wsparcie psychiczne; |
||
| 69 | * III Apgar; |
||
| 70 | * III Waga; |
||
| 71 | * III Kontakt; |
||
| 72 | * III Zabiegi; |
||
| 73 | * III Krwawienie; |
||
| 74 | * III Nacięcie; |
||
| 75 | * III Higiena; |
||
| 76 | * III Dieta; |
||
| 77 | * III Pomiar parametrów życiowych; |
||
| 78 | * III Wydalanie; |
||
| 79 | * III Leki; |
||
| 80 | * III Edukacja zdrowotna i wsparcie psychiczne; |
||
| 81 | * IV Obserwacja; |
||
| 82 | * IV Pomiar parametrów życiowych; |
||
| 83 | * IV Karmienie; |
||
| 84 | * IV Edukacja zdrowotna i wsparcie psychiczne; |
||
| 85 | */ |
||
| 86 | /** |
||
| 87 | * |
||
| 88 | * @var string $typ typ pacjenta |
||
| 89 | */ |
||
| 90 | protected $typ = "POR"; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 94 | */ |
||
| 95 | public $iCiaza; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 99 | */ |
||
| 100 | public $iWywiad; |
||
| 101 | /** |
||
| 102 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 103 | */ |
||
| 104 | public $iPozycja; |
||
| 105 | /** |
||
| 106 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 107 | */ |
||
| 108 | public $iHigiena; |
||
| 109 | /** |
||
| 110 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 111 | */ |
||
| 112 | public $iDieta; |
||
| 113 | /** |
||
| 114 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 115 | */ |
||
| 116 | public $iPomiarParametrowZyciowych; |
||
| 117 | /** |
||
| 118 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 119 | */ |
||
| 120 | public $iASP; |
||
| 121 | /** |
||
| 122 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 123 | */ |
||
| 124 | public $iPostepPorodu; |
||
| 125 | /** |
||
| 126 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 127 | */ |
||
| 128 | public $iWydalanie; |
||
| 129 | /** |
||
| 130 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 131 | */ |
||
| 132 | public $iPecherzPlodowy; |
||
| 133 | /** |
||
| 134 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 135 | */ |
||
| 136 | public $iCwiczeniaOddechowe; |
||
| 137 | /** |
||
| 138 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 139 | */ |
||
| 140 | public $iLeki; |
||
| 141 | /** |
||
| 142 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 143 | */ |
||
| 144 | public $iEdukacjaZdrowotnaIWsparciePsychiczne; |
||
| 145 | /** |
||
| 146 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 147 | */ |
||
| 148 | public $iICzas; |
||
| 149 | /** |
||
| 150 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 151 | */ |
||
| 152 | public $iIPozycja; |
||
| 153 | /** |
||
| 154 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 155 | */ |
||
| 156 | public $iICzystoscKrocza; |
||
| 157 | /** |
||
| 158 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 159 | */ |
||
| 160 | public $iINaciecie; |
||
| 161 | /** |
||
| 162 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 163 | */ |
||
| 164 | public $iIAktywnosc; |
||
| 165 | /** |
||
| 166 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 167 | */ |
||
| 168 | public $iIHigiena; |
||
| 169 | /** |
||
| 170 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 171 | */ |
||
| 172 | public $iIDieta; |
||
| 173 | /** |
||
| 174 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 175 | */ |
||
| 176 | public $iIPomiarParametrowZyciowych; |
||
| 177 | /** |
||
| 178 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 179 | */ |
||
| 180 | public $iIASP; |
||
| 181 | /** |
||
| 182 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 183 | */ |
||
| 184 | public $iIWydalanie; |
||
| 185 | /** |
||
| 186 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 187 | */ |
||
| 188 | public $iILeki; |
||
| 189 | /** |
||
| 190 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 191 | */ |
||
| 192 | public $iIEdukacjaZdrowotnaIWsparciePsychiczne; |
||
| 193 | /** |
||
| 194 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 195 | */ |
||
| 196 | public $iIIApgar; |
||
| 197 | /** |
||
| 198 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 199 | */ |
||
| 200 | public $iIIWaga; |
||
| 201 | /** |
||
| 202 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 203 | */ |
||
| 204 | public $iIIKontakt; |
||
| 205 | /** |
||
| 206 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 207 | */ |
||
| 208 | public $iIIZabiegi; |
||
| 209 | /** |
||
| 210 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 211 | */ |
||
| 212 | public $iIIKrwawienie; |
||
| 213 | /** |
||
| 214 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 215 | */ |
||
| 216 | public $iIINaciecie; |
||
| 217 | /** |
||
| 218 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 219 | */ |
||
| 220 | public $iIIHigiena; |
||
| 221 | /** |
||
| 222 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 223 | */ |
||
| 224 | public $iIIDieta; |
||
| 225 | /** |
||
| 226 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 227 | */ |
||
| 228 | public $iIIPomiarParametrowZyciowych; |
||
| 229 | /** |
||
| 230 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 231 | */ |
||
| 232 | public $iIIWydalanie; |
||
| 233 | /** |
||
| 234 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 235 | */ |
||
| 236 | public $iIILeki; |
||
| 237 | /** |
||
| 238 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 239 | */ |
||
| 240 | public $iIIEdukacjaZdrowotnaIWsparciePsychiczne; |
||
| 241 | /** |
||
| 242 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 243 | */ |
||
| 244 | public $iVObserwacja; |
||
| 245 | /** |
||
| 246 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 247 | */ |
||
| 248 | public $iVPomiarParametrowZyciowych; |
||
| 249 | /** |
||
| 250 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 251 | */ |
||
| 252 | public $iVKarmienie; |
||
| 253 | /** |
||
| 254 | * @Column(columnDefinition="TINYINT(4) DEFAULT 0") |
||
| 255 | */ |
||
| 256 | public $iVEdukacjaZdrowotnaIWsparciePsychiczne; |
||
| 257 | |||
| 258 | |||
| 259 | |||
| 260 | |||
| 261 | |||
| 262 | |||
| 263 | |||
| 264 | |||
| 265 | |||
| 266 | |||
| 267 | /** |
||
| 268 | * getFields |
||
| 269 | * |
||
| 270 | * @return multitype:string |
||
|
|
|||
| 271 | */ |
||
| 272 | public static function getFields() { |
||
| 273 | $superFields = parent::getFields (); |
||
| 274 | $fields = array_merge ( $superFields, array ( |
||
| 275 | "iCiaza", |
||
| 276 | "iWywiad", |
||
| 277 | "iPozycja", |
||
| 278 | "iHigiena", |
||
| 279 | "iDieta", |
||
| 280 | "iPomiarParametrowZyciowych", |
||
| 281 | "iASP", |
||
| 282 | "iPostepPorodu", |
||
| 283 | "iWydalanie", |
||
| 284 | "iPecherzPlodowy", |
||
| 285 | "iCwiczeniaOddechowe", |
||
| 286 | "iLeki", |
||
| 287 | "iEdukacjaZdrowotnaIWsparciePsychiczne", |
||
| 288 | "iICzas", |
||
| 289 | "iIPozycja", |
||
| 290 | "iICzystoscKrocza", |
||
| 291 | "iINaciecie", |
||
| 292 | "iIAktywnosc", |
||
| 293 | "iIHigiena", |
||
| 294 | "iIDieta", |
||
| 295 | "iIPomiarParametrowZyciowych", |
||
| 296 | "iIASP", |
||
| 297 | "iIWydalanie", |
||
| 298 | "iILeki", |
||
| 299 | "iIEdukacjaZdrowotnaIWsparciePsychiczne", |
||
| 300 | "iIIApgar", |
||
| 301 | "iIIWaga", |
||
| 302 | "iIIKontakt", |
||
| 303 | "iIIZabiegi", |
||
| 304 | "iIIKrwawienie", |
||
| 305 | "iIINaciecie", |
||
| 306 | "iIIHigiena", |
||
| 307 | "iIIDieta", |
||
| 308 | "iIIPomiarParametrowZyciowych", |
||
| 309 | "iIIWydalanie", |
||
| 310 | "iIILeki", |
||
| 311 | "iIIEdukacjaZdrowotnaIWsparciePsychiczne", |
||
| 312 | "iVObserwacja", |
||
| 313 | "iVPomiarParametrowZyciowych", |
||
| 314 | "iVKarmienie", |
||
| 315 | "iVEdukacjaZdrowotnaIWsparciePsychiczne" |
||
| 316 | ) ); |
||
| 317 | return $fields; |
||
| 318 | } |
||
| 319 | public function getICiaza() { |
||
| 606 | |||
| 607 | } |
||
| 608 |
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.