| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 302 | 
| Code Lines | 266 | 
| 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  | 
            ||
| 24 | protected function setUp()  | 
            ||
| 25 |     { | 
            ||
| 26 | $this->chart = new ColumnChart();  | 
            ||
| 27 |         $this->chart->setElementID('div-chart') | 
            ||
| 28 | ->getData()->setArrayToDataTable([  | 
            ||
| 29 | ['Time of Day', 'Motivation Level', ['role' => 'annotation'], 'Energy Level', ['role' => 'annotation']],  | 
            ||
| 30 | [['v' => [8, 0, 0], 'f' => '8 am'], 1, '1', 0.25, '0.2'],  | 
            ||
| 31 | [['v' => [9, 0, 0], 'f' => '9 am'], 2, '2', 0.5, '0.5'],  | 
            ||
| 32 | [['v' => [10, 0, 0], 'f' => '10 am'], 3, '3', 1, '1'],  | 
            ||
| 33 | [['v' => [11, 0, 0], 'f' => '11 am'], 4, '4', 2.25, '2'],  | 
            ||
| 34 | [['v' => [12, 0, 0], 'f' => '12 am'], 5, '5', 2.25, '2'],  | 
            ||
| 35 | [['v' => [13, 0, 0], 'f' => '1 pm'], 6, '6', 3, '3'],  | 
            ||
| 36 | [['v' => [14, 0, 0], 'f' => '2 pm'], 7, '7', 3.25, '3'],  | 
            ||
| 37 | [['v' => [15, 0, 0], 'f' => '3 pm'], 8, '8', 5, '5'],  | 
            ||
| 38 | [['v' => [16, 0, 0], 'f' => '4 pm'], 9, '9', 6.5, '6'],  | 
            ||
| 39 | [['v' => [17, 0, 0], 'f' => '5 pm'], 10, '10', 10, '10']  | 
            ||
| 40 | ]);  | 
            ||
| 41 | |||
| 42 | $this->chart->getOptions()->getAnimation()  | 
            ||
| 43 | ->setDuration(1000)  | 
            ||
| 44 |             ->setEasing('in') | 
            ||
| 45 | ->setStartup(true);  | 
            ||
| 46 | |||
| 47 | $this->chart->getOptions()->getAnnotations()  | 
            ||
| 48 | ->setAlwaysOutside(true)  | 
            ||
| 49 | ->getBoxStyle()  | 
            ||
| 50 |                 ->setStroke('#888') | 
            ||
| 51 | ->setStrokeWidth(1)  | 
            ||
| 52 | ->setRx(10)  | 
            ||
| 53 | ->setRy(10);  | 
            ||
| 54 | $this->chart->getOptions()->getAnnotations()  | 
            ||
| 55 | ->getDatum()  | 
            ||
| 56 |                 ->setStyle('point') | 
            ||
| 57 | ->getStem()  | 
            ||
| 58 |                     ->setColor('black') | 
            ||
| 59 | ->setLength(12);  | 
            ||
| 60 | $this->chart->getOptions()->getAnnotations()  | 
            ||
| 61 | ->getDomain()  | 
            ||
| 62 |                 ->setStyle('point') | 
            ||
| 63 | ->getStem()  | 
            ||
| 64 |                     ->setColor('black') | 
            ||
| 65 | ->setLength(5);  | 
            ||
| 66 | $this->chart->getOptions()->getAnnotations()  | 
            ||
| 67 | ->setHighContrast(true);  | 
            ||
| 68 | $this->chart->getOptions()->getAnnotations()  | 
            ||
| 69 | ->getStem()  | 
            ||
| 70 |                 ->setColor('black') | 
            ||
| 71 | ->setLength(5);  | 
            ||
| 72 | $this->chart->getOptions()->getAnnotations()  | 
            ||
| 73 |             ->setStyle('point'); | 
            ||
| 74 | $this->chart->getOptions()->getAnnotations()  | 
            ||
| 75 | ->getTextStyle()  | 
            ||
| 76 |                 ->setFontName('Times-Roman') | 
            ||
| 77 | ->setFontSize(18)  | 
            ||
| 78 | ->setBold(true)  | 
            ||
| 79 | ->setItalic(true)  | 
            ||
| 80 |                 ->setColor('#871b47') | 
            ||
| 81 |                 ->setAuraColor('#d799ae') | 
            ||
| 82 | ->setOpacity(0.8);  | 
            ||
| 83 | |||
| 84 |         $this->chart->getOptions()->setAxisTitlesPosition('out'); | 
            ||
| 85 | |||
| 86 |         //$this->chart->getOptions()->setBackgroundColor('red'); | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 87 | $this->chart->getOptions()->getBackgroundColor()  | 
            ||
| 88 |             ->setStroke('#666') | 
            ||
| 89 | ->setStrokeWidth(0)  | 
            ||
| 90 |             ->setFill('white'); | 
            ||
| 91 | |||
| 92 |         $this->chart->getOptions()->getBar()->setGroupWidth('61.8%'); | 
            ||
| 93 | |||
| 94 | $this->chart->getOptions()->getChartArea()  | 
            ||
| 95 |             //->setBackgroundColor('black') | 
            ||
| 96 | ->getBackgroundColor()  | 
            ||
| 97 |                 ->setStroke('black') | 
            ||
| 98 | ->setStrokeWidth(1);  | 
            ||
| 99 | $this->chart->getOptions()->getChartArea()  | 
            ||
| 100 |             ->setLeft('auto') | 
            ||
| 101 |             ->setTop('auto') | 
            ||
| 102 |             ->setWidth('auto') | 
            ||
| 103 |             ->setHeight('auto'); | 
            ||
| 104 | |||
| 105 | $this->chart->getOptions()->setColors(['red','#004411']);  | 
            ||
| 106 | |||
| 107 | $this->chart->getOptions()->setDataOpacity(1.0);  | 
            ||
| 108 | |||
| 109 | $this->chart->getOptions()->setEnableInteractivity(true);  | 
            ||
| 110 | |||
| 111 | $this->chart->getOptions()->getExplorer()  | 
            ||
| 112 | ->setActions(['dragToPan', 'rightClickToReset'])  | 
            ||
| 113 |             ->setAxis('vertical') | 
            ||
| 114 | ->setKeepInBounds(false)  | 
            ||
| 115 | ->setMaxZoomIn(0.25)  | 
            ||
| 116 | ->setMaxZoomOut(4)  | 
            ||
| 117 | ->setZoomDelta(1.5);  | 
            ||
| 118 | |||
| 119 |         $this->chart->getOptions()->setFocusTarget('datum'); | 
            ||
| 120 | |||
| 121 | $this->chart->getOptions()->setFontSize(12);  | 
            ||
| 122 | |||
| 123 |         $this->chart->getOptions()->setFontName('Arial'); | 
            ||
| 124 | |||
| 125 | $this->chart->getOptions()->setForceIFrame(false);  | 
            ||
| 126 | |||
| 127 | $this->chart->getOptions()->getHAxis()  | 
            ||
| 128 | ->setBaseline(5)  | 
            ||
| 129 |             ->setBaselineColor('black') | 
            ||
| 130 | ->setDirection(1)  | 
            ||
| 131 |             ->setFormat('decimal') | 
            ||
| 132 | ->getGridlines()  | 
            ||
| 133 |                 ->setColor('#CCC') | 
            ||
| 134 | ->setCount(5);  | 
            ||
| 135 | $this->chart->getOptions()->getHAxis()->getGridlines()->getUnits()  | 
            ||
| 136 |             ->getYears()->setFormat('yyyy'); | 
            ||
| 137 | $this->chart->getOptions()->getHAxis()->getGridlines()->getUnits()  | 
            ||
| 138 |             ->getMonths()->setFormat('M'); | 
            ||
| 139 | $this->chart->getOptions()->getHAxis()->getGridlines()->getUnits()  | 
            ||
| 140 |             ->getDays()->setFormat('d'); | 
            ||
| 141 | $this->chart->getOptions()->getHAxis()->getGridlines()->getUnits()  | 
            ||
| 142 |             ->getHours()->setFormat('H'); | 
            ||
| 143 | $this->chart->getOptions()->getHAxis()->getGridlines()->getUnits()  | 
            ||
| 144 |             ->getMinutes()->setFormat('i'); | 
            ||
| 145 | $this->chart->getOptions()->getHAxis()->getGridlines()->getUnits()  | 
            ||
| 146 |             ->getSeconds()->setFormat('s'); | 
            ||
| 147 | $this->chart->getOptions()->getHAxis()->getGridlines()->getUnits()  | 
            ||
| 148 |             ->getMilliseconds()->setFormat('u'); | 
            ||
| 149 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()  | 
            ||
| 150 |             ->setColor('black') | 
            ||
| 151 | ->setCount(0);  | 
            ||
| 152 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 153 |             ->getYears()->setFormat('yyyy'); | 
            ||
| 154 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 155 |             ->getMonths()->setFormat('M'); | 
            ||
| 156 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 157 |             ->getDays()->setFormat('d'); | 
            ||
| 158 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 159 |             ->getHours()->setFormat('H'); | 
            ||
| 160 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 161 |             ->getMinutes()->setFormat('i'); | 
            ||
| 162 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 163 |             ->getSeconds()->setFormat('s'); | 
            ||
| 164 | $this->chart->getOptions()->getHAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 165 |             ->getMilliseconds()->setFormat('u'); | 
            ||
| 166 | $this->chart->getOptions()->getHAxis()  | 
            ||
| 167 | ->setLogScale(false)  | 
            ||
| 168 |             ->setScaleType('log') | 
            ||
| 169 |             ->setTextPosition('out') | 
            ||
| 170 | ->getTextStyle()  | 
            ||
| 171 |                 ->setFontName('Times-Roman') | 
            ||
| 172 | ->setFontSize(12)  | 
            ||
| 173 | ->setBold(true)  | 
            ||
| 174 | ->setItalic(true)  | 
            ||
| 175 |                 ->setColor('black'); | 
            ||
| 176 | $this->chart->getOptions()->getHAxis()  | 
            ||
| 177 | ->setTicks([5,10,15,20])  | 
            ||
| 178 |             ->setTitle('title') | 
            ||
| 179 | ->getTitleTextStyle()  | 
            ||
| 180 |                 ->setColor('black') | 
            ||
| 181 |                 ->setFontName('Arial') | 
            ||
| 182 | ->setFontSize(18)  | 
            ||
| 183 | ->setBold(true)  | 
            ||
| 184 | ->setItalic(true);  | 
            ||
| 185 | $this->chart->getOptions()->getHAxis()  | 
            ||
| 186 | ->setAllowContainerBoundaryTextCufoff(false)  | 
            ||
| 187 | ->setSlantedText(false)  | 
            ||
| 188 | ->setSlantedTextAngle(30)  | 
            ||
| 189 | ->setMaxAlternation(2)  | 
            ||
| 190 | ->setMaxTextLines(5)  | 
            ||
| 191 | ->setMinTextSpacing(5)  | 
            ||
| 192 | ->setShowTextEvery(1)  | 
            ||
| 193 | ->setMaxValue(100)  | 
            ||
| 194 | ->setMinValue(1)  | 
            ||
| 195 |             ->setViewWindowMode('pretty'); | 
            ||
| 196 | $this->chart->getOptions()->getHAxis()  | 
            ||
| 197 | ->getViewWindow()  | 
            ||
| 198 | ->setMax(100)  | 
            ||
| 199 | ->setMin(1);  | 
            ||
| 200 | |||
| 201 | $this->chart->getOptions()->setHeight(500);  | 
            ||
| 202 | |||
| 203 | $this->chart->getOptions()->setIsStacked(false);  | 
            ||
| 204 | |||
| 205 | $this->chart->getOptions()->getLegend()  | 
            ||
| 206 |             ->setPosition('right') | 
            ||
| 207 |             ->setAlignment('start') | 
            ||
| 208 | ->getTextStyle()  | 
            ||
| 209 |                 ->setColor('black') | 
            ||
| 210 |                 ->setFontName('Arial') | 
            ||
| 211 | ->setFontSize(10)  | 
            ||
| 212 | ->setBold(false)  | 
            ||
| 213 | ->setItalic(false);  | 
            ||
| 214 | |||
| 215 |         $this->chart->getOptions()->setOrientation('horizontal'); | 
            ||
| 216 | |||
| 217 | $this->chart->getOptions()->setReverseCategories(false);  | 
            ||
| 218 | |||
| 219 | $this->chart->getOptions()->setSeries([  | 
            ||
| 220 | ['color' => 'black', 'visibleInLegend' => false], [], [],  | 
            ||
| 221 | ['color' => 'red', 'visibleInLegend' => false]  | 
            ||
| 222 | ]);  | 
            ||
| 223 | |||
| 224 |         $this->chart->getOptions()->setTheme('maximized'); | 
            ||
| 225 | |||
| 226 |         $this->chart->getOptions()->setTitle('Title'); | 
            ||
| 227 | |||
| 228 |         $this->chart->getOptions()->setTitlePosition('out'); | 
            ||
| 229 | |||
| 230 | $this->chart->getOptions()->getTitleTextStyle()  | 
            ||
| 231 |             ->setColor('black') | 
            ||
| 232 |             ->setFontName('Arial') | 
            ||
| 233 | ->setFontSize(18)  | 
            ||
| 234 | ->setBold(false)  | 
            ||
| 235 | ->setItalic(false);  | 
            ||
| 236 | |||
| 237 | $this->chart->getOptions()->getTooltip()  | 
            ||
| 238 | ->setIgnoreBounds(false)  | 
            ||
| 239 | ->setIsHtml(false)  | 
            ||
| 240 | ->setShowColorCode(false)  | 
            ||
| 241 |             ->setTrigger('focus') | 
            ||
| 242 | ->getTextStyle()  | 
            ||
| 243 |                 ->setColor('black') | 
            ||
| 244 |                 ->setFontName('Arial') | 
            ||
| 245 | ->setFontSize(10)  | 
            ||
| 246 | ->setBold(false)  | 
            ||
| 247 | ->setItalic(false);  | 
            ||
| 248 | |||
| 249 | $this->chart->getOptions()->setTrendlines([new Trendlines(), new Trendlines()]);  | 
            ||
| 250 | |||
| 251 | $vAxis1 = new VAxis();  | 
            ||
| 252 |         $vAxis1->setTitle('v1'); | 
            ||
| 253 | $vAxis2 = new VAxis();  | 
            ||
| 254 |         $vAxis2->setTitle('v2'); | 
            ||
| 255 | $this->chart->getOptions()->setVAxes([$vAxis1, $vAxis2]);  | 
            ||
| 256 | |||
| 257 | $this->chart->getOptions()->getVAxis()  | 
            ||
| 258 | ->setBaseline(5)  | 
            ||
| 259 |             ->setBaselineColor('black') | 
            ||
| 260 | ->setDirection(1)  | 
            ||
| 261 |             ->setFormat('decimal') | 
            ||
| 262 | ->getGridlines()  | 
            ||
| 263 |                 ->setColor('#CCC') | 
            ||
| 264 | ->setCount(5);  | 
            ||
| 265 | $this->chart->getOptions()->getVAxis()->getGridlines()->getUnits()  | 
            ||
| 266 |             ->getYears()->setFormat('yyyy'); | 
            ||
| 267 | $this->chart->getOptions()->getVAxis()->getGridlines()->getUnits()  | 
            ||
| 268 |             ->getMonths()->setFormat('M'); | 
            ||
| 269 | $this->chart->getOptions()->getVAxis()->getGridlines()->getUnits()  | 
            ||
| 270 |             ->getDays()->setFormat('d'); | 
            ||
| 271 | $this->chart->getOptions()->getVAxis()->getGridlines()->getUnits()  | 
            ||
| 272 |             ->getHours()->setFormat('H'); | 
            ||
| 273 | $this->chart->getOptions()->getVAxis()->getGridlines()->getUnits()  | 
            ||
| 274 |             ->getMinutes()->setFormat('i'); | 
            ||
| 275 | $this->chart->getOptions()->getVAxis()->getGridlines()->getUnits()  | 
            ||
| 276 |             ->getSeconds()->setFormat('s'); | 
            ||
| 277 | $this->chart->getOptions()->getVAxis()->getGridlines()->getUnits()  | 
            ||
| 278 |             ->getMilliseconds()->setFormat('u'); | 
            ||
| 279 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()  | 
            ||
| 280 |             ->setColor('black') | 
            ||
| 281 | ->setCount(0);  | 
            ||
| 282 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 283 |             ->getYears()->setFormat('yyyy'); | 
            ||
| 284 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 285 |             ->getMonths()->setFormat('M'); | 
            ||
| 286 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 287 |             ->getDays()->setFormat('d'); | 
            ||
| 288 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 289 |             ->getHours()->setFormat('H'); | 
            ||
| 290 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 291 |             ->getMinutes()->setFormat('i'); | 
            ||
| 292 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 293 |             ->getSeconds()->setFormat('s'); | 
            ||
| 294 | $this->chart->getOptions()->getVAxis()->getMinorGridlines()->getUnits()  | 
            ||
| 295 |             ->getMilliseconds()->setFormat('u'); | 
            ||
| 296 | $this->chart->getOptions()->getVAxis()  | 
            ||
| 297 | ->setLogScale(false)  | 
            ||
| 298 |             ->setScaleType('log') | 
            ||
| 299 |             ->setTextPosition('out') | 
            ||
| 300 | ->getTextStyle()  | 
            ||
| 301 |                 ->setFontName('Times-Roman') | 
            ||
| 302 | ->setFontSize(12)  | 
            ||
| 303 | ->setBold(true)  | 
            ||
| 304 | ->setItalic(true)  | 
            ||
| 305 |                 ->setColor('black'); | 
            ||
| 306 | $this->chart->getOptions()->getVAxis()  | 
            ||
| 307 | ->setTicks([5,10,15,20])  | 
            ||
| 308 |             ->setTitle('title') | 
            ||
| 309 | ->getTitleTextStyle()  | 
            ||
| 310 |                 ->setColor('black') | 
            ||
| 311 |                 ->setFontName('Arial') | 
            ||
| 312 | ->setFontSize(18)  | 
            ||
| 313 | ->setBold(true)  | 
            ||
| 314 | ->setItalic(true);  | 
            ||
| 315 | $this->chart->getOptions()->getVAxis()  | 
            ||
| 316 | ->setMaxValue(100)  | 
            ||
| 317 | ->setMinValue(1)  | 
            ||
| 318 |             ->setViewWindowMode('pretty'); | 
            ||
| 319 | $this->chart->getOptions()->getVAxis()  | 
            ||
| 320 | ->getViewWindow()  | 
            ||
| 321 | ->setMax(100)  | 
            ||
| 322 | ->setMin(1);  | 
            ||
| 323 | |||
| 324 | $this->chart->getOptions()->setWidth(700);  | 
            ||
| 325 | }  | 
            ||
| 326 | |||
| 334 | 
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.