| Conditions | 2 |
| Paths | 2 |
| Total Lines | 69 |
| Code Lines | 51 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 60 | public function index($request) |
||
| 61 | { |
||
| 62 | if (class_exists(\Sunnysideup\WebpackRequirementsBackend\View\RequirementsBackendForWebpack::class, true)) { |
||
| 63 | Config::modify()->set( |
||
| 64 | \Sunnysideup\WebpackRequirementsBackend\View\RequirementsBackendForWebpack::class, |
||
| 65 | 'enabled', |
||
| 66 | false |
||
| 67 | ); |
||
| 68 | } |
||
| 69 | TableFilterSortAPI::include_requirements( |
||
| 70 | $tableSelector = '.tfs-holder', |
||
| 71 | $blockArray = [], |
||
| 72 | $jqueryLocation = 'https://code.jquery.com/jquery-3.5.1.min.js', |
||
| 73 | $includeInPage = false, |
||
| 74 | $jsSettings = [ |
||
| 75 | 'rowRawData' => $this->Data(), |
||
| 76 | 'scrollToTopAtPageOpening' => true, |
||
| 77 | 'sizeOfFixedHeader' => 0, |
||
| 78 | 'maximumNumberOfFilterOptions' => 20, |
||
| 79 | 'filtersParentPageID' => '', |
||
| 80 | 'favouritesParentPageID' => '', |
||
| 81 | 'visibleRowCount' => 20, |
||
| 82 | 'startWithOpenFilter' => true, |
||
| 83 | 'dataDictionary' => [ |
||
| 84 | 'Type' => [ |
||
| 85 | 'Label' => 'Type', |
||
| 86 | 'CanFilter' => true, |
||
| 87 | ], |
||
| 88 | 'Vendor' => [ |
||
| 89 | 'Label' => 'Vendor', |
||
| 90 | 'CanFilter' => true, |
||
| 91 | ], |
||
| 92 | 'Package' => [ |
||
| 93 | 'Label' => 'Package', |
||
| 94 | 'CanFilter' => true, |
||
| 95 | ], |
||
| 96 | 'ShorterClassName' => [ |
||
| 97 | 'Label' => 'Class', |
||
| 98 | 'CanFilter' => true, |
||
| 99 | ], |
||
| 100 | 'Property' => [ |
||
| 101 | 'Label' => 'Property', |
||
| 102 | 'CanFilter' => true, |
||
| 103 | ], |
||
| 104 | 'IsDefault' => [ |
||
| 105 | 'Label' => 'Is Default', |
||
| 106 | 'CanFilter' => true, |
||
| 107 | ], |
||
| 108 | 'HasDefault' => [ |
||
| 109 | 'Label' => 'Has Default', |
||
| 110 | 'CanFilter' => false, |
||
| 111 | ], |
||
| 112 | 'HasValue' => [ |
||
| 113 | 'Label' => 'Has Value', |
||
| 114 | 'CanFilter' => true, |
||
| 115 | ], |
||
| 116 | 'Value' => [ |
||
| 117 | 'Label' => 'Value', |
||
| 118 | 'CanFilter' => false, |
||
| 119 | ], |
||
| 120 | 'Default' => [ |
||
| 121 | 'Label' => 'Default Value', |
||
| 122 | 'CanFilter' => false, |
||
| 123 | ], |
||
| 124 | ], |
||
| 125 | ] |
||
| 126 | ); |
||
| 127 | |||
| 128 | return $this->renderWith('Sunnysideup/ConfigManager/Control/CheckConfigsTable'); |
||
| 129 | } |
||
| 165 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.