| Conditions | 1 |
| Paths | 1 |
| Total Lines | 92 |
| Code Lines | 82 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 74 | public function renderFetchesDataProvider(): array |
||
| 75 | { |
||
| 76 | return [ |
||
| 77 | 'fetch: table pages' => [ |
||
| 78 | 'from' => 'pages', |
||
| 79 | 'field' => 'title', |
||
| 80 | 'sortby' => 'sorting', |
||
| 81 | 'match' => [], |
||
| 82 | 'limit' => '', |
||
| 83 | 'ignoreEnableFields' => false, |
||
| 84 | 'expected' => 'Main page, Sub page,', |
||
| 85 | 'template' => 'fetch_table_viewhelper', |
||
| 86 | ], |
||
| 87 | 'fetch: table fe_users' => [ |
||
| 88 | 'from' => 'fe_users', |
||
| 89 | 'field' => 'username', |
||
| 90 | 'sortby' => 'uid', |
||
| 91 | 'match' => [], |
||
| 92 | 'limit' => '', |
||
| 93 | 'ignoreEnableFields' => false, |
||
| 94 | 'expected' => 'testuser, testuser2,', |
||
| 95 | 'template' => 'fetch_table_viewhelper', |
||
| 96 | ], |
||
| 97 | 'fetch: model FrontendUser' => [ |
||
| 98 | 'from' => \TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class, |
||
| 99 | 'field' => 'username', |
||
| 100 | 'sortby' => 'uid', |
||
| 101 | 'match' => [], |
||
| 102 | 'limit' => '', |
||
| 103 | 'ignoreEnableFields' => false, |
||
| 104 | 'expected' => 'testuser, testuser2,', |
||
| 105 | 'template' => 'fetch_model_viewhelper', |
||
| 106 | ], |
||
| 107 | 'fetch: table pages in pid 1' => [ |
||
| 108 | 'from' => 'pages', |
||
| 109 | 'field' => 'title', |
||
| 110 | 'sortby' => 'sorting', |
||
| 111 | 'match' => ['pid' => '1'], |
||
| 112 | 'limit' => '', |
||
| 113 | 'ignoreEnableFields' => false, |
||
| 114 | 'expected' => 'Sub page,', |
||
| 115 | 'template' => 'fetch_table_viewhelper', |
||
| 116 | ], |
||
| 117 | 'fetch: model FrontendUser with uid 2' => [ |
||
| 118 | 'from' => \TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class, |
||
| 119 | 'field' => 'username', |
||
| 120 | 'sortby' => 'uid', |
||
| 121 | 'match' => ['uid' => 2], |
||
| 122 | 'limit' => '', |
||
| 123 | 'ignoreEnableFields' => false, |
||
| 124 | 'expected' => 'testuser2,', |
||
| 125 | 'template' => 'fetch_model_viewhelper', |
||
| 126 | ], |
||
| 127 | 'fetch: table pages including hidden ones' => [ |
||
| 128 | 'from' => 'pages', |
||
| 129 | 'field' => 'title', |
||
| 130 | 'sortby' => 'sorting', |
||
| 131 | 'match' => [], |
||
| 132 | 'limit' => '', |
||
| 133 | 'ignoreEnableFields' => true, |
||
| 134 | 'expected' => 'Main page, Sub page,', |
||
| 135 | 'template' => 'fetch_table_viewhelper', |
||
| 136 | ], |
||
| 137 | 'fetch: model FrontendUser including hidden ones' => [ |
||
| 138 | 'from' => \TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class, |
||
| 139 | 'field' => 'username', |
||
| 140 | 'sortby' => 'uid', |
||
| 141 | 'match' => [], |
||
| 142 | 'limit' => '', |
||
| 143 | 'ignoreEnableFields' => true, |
||
| 144 | 'expected' => 'testuser, testuser2, testuser3,', |
||
| 145 | 'template' => 'fetch_model_viewhelper', |
||
| 146 | ], |
||
| 147 | 'fetch: table pages with limit' => [ |
||
| 148 | 'from' => 'pages', |
||
| 149 | 'field' => 'title', |
||
| 150 | 'sortby' => 'sorting', |
||
| 151 | 'match' => [], |
||
| 152 | 'limit' => '1', |
||
| 153 | 'ignoreEnableFields' => false, |
||
| 154 | 'expected' => 'Main page,', |
||
| 155 | 'template' => 'fetch_table_viewhelper', |
||
| 156 | ], |
||
| 157 | 'fetch: model FrontendUser with limit' => [ |
||
| 158 | 'from' => \TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class, |
||
| 159 | 'field' => 'username', |
||
| 160 | 'sortby' => 'uid', |
||
| 161 | 'match' => [], |
||
| 162 | 'limit' => '1', |
||
| 163 | 'ignoreEnableFields' => false, |
||
| 164 | 'expected' => 'testuser,', |
||
| 165 | 'template' => 'fetch_model_viewhelper', |
||
| 166 | ], |
||
| 170 |