| Conditions | 13 | 
| Paths | 469 | 
| Total Lines | 121 | 
| Code Lines | 80 | 
| 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 | public function getOne(Request $request)  | 
            ||
| 25 |     { | 
            ||
| 26 |         $idPlayer = $request->query->get('idPlayer', 0); | 
            ||
| 27 |         $idChart = $request->query->get('idChart', 0); | 
            ||
| 28 | |||
| 29 |         $playerChart = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:PlayerChart')->getFromUnique($idPlayer, $idChart); | 
            ||
| 30 |         if ($playerChart === null) { | 
            ||
| 31 | $playerChart = new PlayerChart();  | 
            ||
| 32 |             $chart = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Chart')->find($idChart); | 
            ||
| 33 |             $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->find($idPlayer); | 
            ||
| 34 | $playerChart->setIdPlayerChart(-1);  | 
            ||
| 35 | $playerChart->setChart($chart);  | 
            ||
| 36 | $playerChart->setPlayer($player);  | 
            ||
| 37 |             foreach ($chart->getLibs() as $lib) { | 
            ||
| 38 | $playerChartLib = new PlayerChartLib();  | 
            ||
| 39 | $playerChartLib->setId(-1);  | 
            ||
| 40 | $playerChartLib->setLibChart($lib);  | 
            ||
| 41 | $playerChart->addLib($playerChartLib);  | 
            ||
| 42 | }  | 
            ||
| 43 | }  | 
            ||
| 44 | return $playerChart;  | 
            ||
| 45 | }  | 
            ||
| 46 | }  | 
            ||
| 47 |