We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 5 | 
| Paths | 8 | 
| Total Lines | 56 | 
| Code Lines | 39 | 
| 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  | 
            ||
| 44 | |||
| 45 |         if (count($constraints)) { | 
            ||
| 46 | $query->matching($query->logicalAnd($constraints));  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | return $query->execute();  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 50 | }  | 
            ||
| 51 | |||
| 52 | public function getCollectionForMetadata($pages)  | 
            ||
| 53 |     { | 
            ||
| 54 | // Get list of collections to show.  | 
            ||
| 55 | $query = $this->createQuery();  | 
            ||
| 56 | |||
| 57 |         $query->matching($query->equals('pid', $pages)); | 
            ||
| 58 | |||
| 59 | return $query->execute();  | 
            ||
| 60 | }  | 
            ||
| 61 | |||
| 62 | /**  | 
            ||
| 63 | * Finds all collection for the given settings  | 
            ||
| 64 | *  | 
            ||
| 65 | * @param array $settings  | 
            ||
| 66 | *  | 
            ||
| 67 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface  | 
            ||
| 68 | */  | 
            ||
| 69 | public function findCollectionsBySettings($settings = [])  | 
            ||
| 70 |     { | 
            ||
| 71 | $query = $this->createQuery();  | 
            ||
| 72 | |||
| 73 | $constraints = [];  | 
            ||
| 74 | |||
| 75 |         if ($settings['collections']) { | 
            ||
| 76 |             $constraints[] = $query->in('uid', GeneralUtility::intExplode(',', $settings['collections'])); | 
            ||
| 77 | }  | 
            ||
| 78 | |||
| 79 |         if ($settings['index_name']) { | 
            ||
| 80 |             $constraints[] = $query->in('index_name', $settings['index_name']); | 
            ||
| 81 | }  | 
            ||
| 82 | |||
| 83 | // do not find user created collections (used by oai-pmh plugin)  | 
            ||
| 84 |         if (!$settings['show_userdefined']) { | 
            ||
| 85 |             $constraints[] = $query->equals('fe_cruser_id', 0); | 
            ||
| 86 | }  | 
            ||
| 87 | |||
| 88 | // do not find collections without oai_name set (used by oai-pmh plugin)  | 
            ||
| 89 |         if ($settings['hideEmptyOaiNames']) { | 
            ||
| 90 |             $constraints[] = $query->logicalNot($query->equals('oai_name', '')); | 
            ||
| 91 | }  | 
            ||
| 92 | |||
| 93 |         if (count($constraints)) { | 
            ||
| 94 | $query->matching(  | 
            ||
| 95 | $query->logicalAnd($constraints)  | 
            ||
| 96 | );  | 
            ||
| 97 | }  | 
            ||
| 98 | |||
| 99 | // order by oai_name  | 
            ||
| 100 | $query->setOrderings(  | 
            ||
| 139 |