| Conditions | 15 | 
| Paths | 9 | 
| Total Lines | 49 | 
| Code Lines | 22 | 
| 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 | ||
| 26 | public function async(ModelConfigurationInterface $model, Request $request, Application $application, $name = null) | ||
| 27 |     { | ||
| 28 | $payload = $request->payload ?: []; | ||
| 29 | |||
| 30 | $display = $model->fireDisplay($payload); | ||
| 31 | |||
| 32 |         if ($display instanceof DisplayTabbed) { | ||
| 33 | $tabs = $display->getTabs(); | ||
| 34 | |||
| 35 |             foreach ($tabs as $tab) { | ||
| 36 | $content = $tab->getContent(); | ||
| 37 | |||
| 38 |                 if ($content instanceof FormElements) { | ||
| 39 |                     foreach ($content->getElements() as $element) { | ||
| 40 | |||
| 41 | //Return data-table if inside FormElements | ||
| 42 |                         if ($element instanceof DisplayDatatablesAsyncAlterPaginate) { | ||
| 43 |                             if ($element->getName() == $name) { | ||
| 44 | return $this->renderFindedTable($element, $application, $request); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | //Try to find data table in columns | ||
| 49 |                         if ($element instanceof Column) { | ||
| 50 |                             foreach ($element->getElements() as $columnElement) { | ||
| 51 |                                 if ($columnElement instanceof DisplayDatatablesAsyncAlterPaginate) { | ||
| 52 |                                     if ($columnElement->getName() == $name) { | ||
| 53 | return $this->renderFindedTable($columnElement, $application, $request); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | } | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | //Finded trully in content-tab | ||
| 62 |                 if ($content instanceof DisplayDatatablesAsyncAlterPaginate) { | ||
| 63 |                     if ($content->getName() == $name) { | ||
| 64 | return $this->renderFindedTable($content, $application, $request); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 |         if ($display instanceof DisplayDatatablesAsyncAlterPaginate) { | ||
| 71 | return $this->renderFindedTable($display, $application, $request); | ||
| 72 | } | ||
| 73 | |||
| 74 | abort(404); | ||
| 75 | } | ||
| 124 |