We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 21 | 
| Paths | 4767 | 
| Total Lines | 174 | 
| Code Lines | 127 | 
| 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  | 
            ||
| 223 | protected function showSingleCollection($id)  | 
            ||
| 224 |     { | 
            ||
| 225 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);  | 
            ||
| 226 |         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_collections'); | 
            ||
| 227 | |||
| 228 | $additionalWhere = '';  | 
            ||
| 229 | // Should user-defined collections be shown?  | 
            ||
| 230 |         if (empty($this->settings['show_userdefined'])) { | 
            ||
| 231 |             $additionalWhere = $queryBuilder->expr()->eq('tx_dlf_collections.fe_cruser_id', 0); | 
            ||
| 232 |         } elseif ($this->settings['show_userdefined'] > 0) { | 
            ||
| 233 |             $additionalWhere = $queryBuilder->expr()->neq('tx_dlf_collections.fe_cruser_id', 0); | 
            ||
| 234 | }  | 
            ||
| 235 | |||
| 236 | // Get collection information from DB  | 
            ||
| 237 | $collection = $queryBuilder  | 
            ||
| 238 | ->select(  | 
            ||
| 239 | 'tx_dlf_collections.uid AS uid', // required by getRecordOverlay()  | 
            ||
| 240 | 'tx_dlf_collections.pid AS pid', // required by getRecordOverlay()  | 
            ||
| 241 | 'tx_dlf_collections.sys_language_uid AS sys_language_uid', // required by getRecordOverlay()  | 
            ||
| 242 | 'tx_dlf_collections.index_name AS index_name',  | 
            ||
| 243 | 'tx_dlf_collections.index_search as index_search',  | 
            ||
| 244 | 'tx_dlf_collections.label AS label',  | 
            ||
| 245 | 'tx_dlf_collections.description AS description',  | 
            ||
| 246 | 'tx_dlf_collections.thumbnail AS thumbnail',  | 
            ||
| 247 | 'tx_dlf_collections.fe_cruser_id'  | 
            ||
| 248 | )  | 
            ||
| 249 |             ->from('tx_dlf_collections') | 
            ||
| 250 | ->where(  | 
            ||
| 251 |                 $queryBuilder->expr()->eq('tx_dlf_collections.pid', intval($this->settings['pages'])), | 
            ||
| 252 |                 $queryBuilder->expr()->eq('tx_dlf_collections.uid', intval($id)), | 
            ||
| 253 | $additionalWhere,  | 
            ||
| 254 | $queryBuilder->expr()->andX(  | 
            ||
| 255 | $queryBuilder->expr()->orX(  | 
            ||
| 256 |                         $queryBuilder->expr()->in('tx_dlf_collections.sys_language_uid', [-1, 0]), | 
            ||
| 257 |                         $queryBuilder->expr()->eq('tx_dlf_collections.sys_language_uid', $GLOBALS['TSFE']->sys_language_uid) | 
            ||
| 258 | ),  | 
            ||
| 259 |                     $queryBuilder->expr()->eq('tx_dlf_collections.l18n_parent', 0) | 
            ||
| 260 | ),  | 
            ||
| 261 |                 Helper::whereExpression('tx_dlf_collections') | 
            ||
| 262 | )  | 
            ||
| 263 | ->setMaxResults(1)  | 
            ||
| 264 | ->execute();  | 
            ||
| 265 | |||
| 266 | // Get language overlay if on alterative website language.  | 
            ||
| 267 | $pageRepository = GeneralUtility::makeInstance(PageRepository::class);  | 
            ||
| 268 |         if ($resArray = $collection->fetch()) { | 
            ||
| 269 |             if ($resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content) { | 
            ||
| 270 |                 $collectionData = $pageRepository->getRecordOverlay('tx_dlf_collections', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); | 
            ||
| 271 | // keep the index_name of the default language  | 
            ||
| 272 | $collectionData['index_name'] = $resArray['index_name'];  | 
            ||
| 273 |             } else { | 
            ||
| 274 | $collectionData = $resArray;  | 
            ||
| 275 | }  | 
            ||
| 276 |         } else { | 
            ||
| 277 |             $this->logger->warning('No collection with UID ' . $id . ' found.'); | 
            ||
| 278 | return;  | 
            ||
| 279 | }  | 
            ||
| 280 | // Fetch corresponding document UIDs from Solr.  | 
            ||
| 281 |         if ($collectionData['index_search'] != '') { | 
            ||
| 282 |             $solr_query = '(' . $collectionData['index_search'] . ')'; | 
            ||
| 283 |         } else { | 
            ||
| 284 |             $solr_query = 'collection:("' . $collectionData['index_name'] . '") AND toplevel:true'; | 
            ||
| 285 | }  | 
            ||
| 286 | $solr = Solr::getInstance($this->settings['solrcore']);  | 
            ||
| 287 |         if (!$solr->ready) { | 
            ||
| 288 |             $this->logger->error('Apache Solr not available'); | 
            ||
| 289 | return;  | 
            ||
| 290 | }  | 
            ||
| 291 | $params['fields'] = 'uid';  | 
            ||
| 292 | $params['sort'] = ['uid' => 'asc'];  | 
            ||
| 293 | $solrResult = $solr->search_raw($solr_query, $params);  | 
            ||
| 294 | // Initialize array  | 
            ||
| 295 | $documentSet = [];  | 
            ||
| 296 |         foreach ($solrResult as $doc) { | 
            ||
| 297 |             if ($doc->uid) { | 
            ||
| 298 | $documentSet[] = $doc->uid;  | 
            ||
| 299 | }  | 
            ||
| 300 | }  | 
            ||
| 301 | $documentSet = array_unique($documentSet);  | 
            ||
| 302 |         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents'); | 
            ||
| 303 | // Fetch document info for UIDs in $documentSet from DB  | 
            ||
| 304 | $documents = $queryBuilder  | 
            ||
| 305 | ->select(  | 
            ||
| 306 | 'tx_dlf_documents.uid AS uid',  | 
            ||
| 307 | 'tx_dlf_documents.metadata_sorting AS metadata_sorting',  | 
            ||
| 308 | 'tx_dlf_documents.volume_sorting AS volume_sorting',  | 
            ||
| 309 | 'tx_dlf_documents.partof AS partof'  | 
            ||
| 310 | )  | 
            ||
| 311 |             ->from('tx_dlf_documents') | 
            ||
| 312 | ->where(  | 
            ||
| 313 |                 $queryBuilder->expr()->eq('tx_dlf_documents.pid', intval($this->settings['pages'])), | 
            ||
| 314 |                 $queryBuilder->expr()->in('tx_dlf_documents.uid', $documentSet), | 
            ||
| 315 |                 Helper::whereExpression('tx_dlf_documents') | 
            ||
| 316 | )  | 
            ||
| 317 | ->execute();  | 
            ||
| 318 | |||
| 319 | $toplevel = [];  | 
            ||
| 320 | $subparts = [];  | 
            ||
| 321 | $listMetadata = [];  | 
            ||
| 322 | // Process results.  | 
            ||
| 323 |         while ($resArray = $documents->fetch()) { | 
            ||
| 324 |             if (empty($listMetadata)) { | 
            ||
| 325 | $listMetadata = [  | 
            ||
| 326 | 'label' => htmlspecialchars($collectionData['label']),  | 
            ||
| 327 | 'description' => $collectionData['description'],  | 
            ||
| 328 | 'thumbnail' => htmlspecialchars($collectionData['thumbnail']),  | 
            ||
| 329 | 'options' => [  | 
            ||
| 330 | 'source' => 'collection',  | 
            ||
| 331 | 'select' => $id,  | 
            ||
| 332 | 'userid' => $collectionData['userid'],  | 
            ||
| 333 |                         'params' => ['filterquery' => [['query' => 'collection_faceting:("' . $collectionData['index_name'] . '")']]], | 
            ||
| 334 | 'core' => '',  | 
            ||
| 335 | 'pid' => $this->settings['pages'],  | 
            ||
| 336 | 'order' => 'title',  | 
            ||
| 337 | 'order.asc' => true  | 
            ||
| 338 | ]  | 
            ||
| 339 | ];  | 
            ||
| 340 | }  | 
            ||
| 341 | // Prepare document's metadata for sorting.  | 
            ||
| 342 | $sorting = unserialize($resArray['metadata_sorting']);  | 
            ||
| 343 |             if (!empty($sorting['type']) && MathUtility::canBeInterpretedAsInteger($sorting['type'])) { | 
            ||
| 344 | $sorting['type'] = Helper::getIndexNameFromUid($sorting['type'], 'tx_dlf_structures', $this->settings['pages']);  | 
            ||
| 345 | }  | 
            ||
| 346 |             if (!empty($sorting['owner']) && MathUtility::canBeInterpretedAsInteger($sorting['owner'])) { | 
            ||
| 347 | $sorting['owner'] = Helper::getIndexNameFromUid($sorting['owner'], 'tx_dlf_libraries', $this->settings['pages']);  | 
            ||
| 348 | }  | 
            ||
| 349 |             if (!empty($sorting['collection']) && MathUtility::canBeInterpretedAsInteger($sorting['collection'])) { | 
            ||
| 350 | $sorting['collection'] = Helper::getIndexNameFromUid($sorting['collection'], 'tx_dlf_collections', $this->settings['pages']);  | 
            ||
| 351 | }  | 
            ||
| 352 | // Split toplevel documents from volumes.  | 
            ||
| 353 |             if ($resArray['partof'] == 0) { | 
            ||
| 354 | $toplevel[$resArray['uid']] = [  | 
            ||
| 355 | 'u' => $resArray['uid'],  | 
            ||
| 356 | 'h' => '',  | 
            ||
| 357 | 's' => $sorting,  | 
            ||
| 358 | 'p' => []  | 
            ||
| 359 | ];  | 
            ||
| 360 |             } else { | 
            ||
| 361 | // volume_sorting should be always set - but it's not a required field. We append the uid to the array key to make it always unique.  | 
            ||
| 362 | $subparts[$resArray['partof']][$resArray['volume_sorting'] . str_pad($resArray['uid'], 9, '0', STR_PAD_LEFT)] = [  | 
            ||
| 363 | 'u' => $resArray['uid'],  | 
            ||
| 364 | 'h' => '',  | 
            ||
| 365 | 's' => $sorting,  | 
            ||
| 366 | 'p' => []  | 
            ||
| 367 | ];  | 
            ||
| 368 | }  | 
            ||
| 369 | }  | 
            ||
| 370 | // Add volumes to the corresponding toplevel documents.  | 
            ||
| 371 |         foreach ($subparts as $partof => $parts) { | 
            ||
| 372 | ksort($parts);  | 
            ||
| 373 |             foreach ($parts as $part) { | 
            ||
| 374 |                 if (!empty($toplevel[$partof])) { | 
            ||
| 375 | $toplevel[$partof]['p'][] = ['u' => $part['u']];  | 
            ||
| 376 |                 } else { | 
            ||
| 377 | $toplevel[$part['u']] = $part;  | 
            ||
| 378 | }  | 
            ||
| 379 | }  | 
            ||
| 380 | }  | 
            ||
| 381 | // Save list of documents.  | 
            ||
| 382 | $list = GeneralUtility::makeInstance(DocumentList::class);  | 
            ||
| 383 | $list->reset();  | 
            ||
| 384 | $list->add(array_values($toplevel));  | 
            ||
| 385 | $listMetadata['options']['numberOfToplevelHits'] = count($list);  | 
            ||
| 386 | $list->metadata = $listMetadata;  | 
            ||
| 387 |         $list->sort('title'); | 
            ||
| 388 | $list->save();  | 
            ||
| 389 | // Clean output buffer.  | 
            ||
| 390 | ob_end_clean();  | 
            ||
| 391 | |||
| 392 | $uri = $this->uriBuilder  | 
            ||
| 393 | ->reset()  | 
            ||
| 394 | ->setTargetPageUid($this->settings['targetPid'])  | 
            ||
| 395 |             ->uriFor('main', [], 'ListView', 'dlf', 'ListView'); | 
            ||
| 396 | $this->redirectToURI($uri);  | 
            ||
| 397 | }  | 
            ||
| 399 | 
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.