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 | /** |
||
46 | * Finds all collections |
||
47 | * |
||
48 | * @param string $uids separated by comma |
||
49 | * |
||
50 | * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
||
51 | */ |
||
52 | public function findAllByUids($uids) |
||
53 | { |
||
54 | $query = $this->createQuery(); |
||
55 | |||
56 | $constraints = []; |
||
57 | $constraints[] = $query->in('uid', $uids); |
||
58 | |||
59 | if (count($constraints)) { |
||
60 | $query->matching($query->logicalAnd($constraints)); |
||
61 | } |
||
62 | |||
63 | return $query->execute(); |
||
|
|||
64 | } |
||
65 | |||
66 | public function getCollectionForMetadata($pages) |
||
67 | { |
||
68 | // Get list of collections to show. |
||
69 | $query = $this->createQuery(); |
||
70 | |||
71 | $query->matching($query->equals('pid', $pages)); |
||
72 | |||
73 | return $query->execute(); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Finds all collection for the given settings |
||
78 | * |
||
79 | * @param array $settings |
||
80 | * |
||
81 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
||
82 | */ |
||
83 | public function findCollectionsBySettings($settings = []) |
||
84 | { |
||
85 | $query = $this->createQuery(); |
||
86 | |||
87 | $constraints = []; |
||
88 | |||
89 | if ($settings['collections']) { |
||
90 | $constraints[] = $query->in('uid', GeneralUtility::intExplode(',', $settings['collections'])); |
||
91 | } |
||
92 | |||
93 | if ($settings['index_name']) { |
||
94 | $constraints[] = $query->in('index_name', $settings['index_name']); |
||
95 | } |
||
96 | |||
97 | // do not find user created collections (used by oai-pmh plugin) |
||
98 | if (!$settings['show_userdefined']) { |
||
99 | $constraints[] = $query->equals('fe_cruser_id', 0); |
||
100 | } |
||
153 |