Conditions | 1 |
Paths | 1 |
Total Lines | 146 |
Code Lines | 86 |
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 |
||
64 | public function __construct() |
||
65 | { |
||
66 | parent::__construct(self::APP_ID); |
||
67 | |||
68 | $container = $this->getContainer(); |
||
69 | |||
70 | // mapper |
||
71 | $container->registerService('FileOperationMapper', function ($c) { |
||
72 | return new FileOperationMapper( |
||
73 | $c->query('ServerContainer')->getDb() |
||
74 | ); |
||
75 | }); |
||
76 | |||
77 | $container->registerService('RecoveredFileOperationMapper', function ($c) { |
||
78 | return new RecoveredFileOperationMapper( |
||
79 | $c->query('ServerContainer')->getDb() |
||
80 | ); |
||
81 | }); |
||
82 | |||
83 | $container->registerService('DetectionDeserializer', function ($c) { |
||
84 | return new DetectionDeserializer( |
||
85 | $c->query('FileOperationMapper') |
||
86 | ); |
||
87 | }); |
||
88 | |||
89 | // services |
||
90 | $container->registerService('FileOperationService', function ($c) { |
||
91 | return new FileOperationService( |
||
92 | $c->query(FileOperationMapper::class), |
||
93 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
||
94 | ); |
||
95 | }); |
||
96 | |||
97 | $container->registerService('RecoveredFileOperationService', function ($c) { |
||
98 | return new RecoveredFileOperationService( |
||
99 | $c->query(FileOperationMapper::class), |
||
100 | $c->query(RecoveredFileOperationMapper::class), |
||
101 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
||
102 | ); |
||
103 | }); |
||
104 | |||
105 | $container->registerService('DetectionService', function ($c) { |
||
106 | return new DetectionService( |
||
107 | $c->query(ILogger::class), |
||
108 | $c->query('FileOperationService'), |
||
109 | $c->query('DetectionDeserializer'), |
||
110 | $c->query('OCP\IConfig'), |
||
111 | $c->query(Classifier::class), |
||
112 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
||
113 | ); |
||
114 | }); |
||
115 | |||
116 | // classifier |
||
117 | $container->registerService('Classifier', function ($c) { |
||
118 | return new Classifier( |
||
119 | $c->query(ILogger::class), |
||
120 | $c->query(FileOperationMapper::class), |
||
121 | $c->query(FileOperationService::class) |
||
122 | ); |
||
123 | }); |
||
124 | |||
125 | // controller |
||
126 | $container->registerService('DetectionController', function ($c) { |
||
127 | return new DetectionController( |
||
128 | $c->query('AppName'), |
||
129 | $c->query('Request'), |
||
130 | $c->query('DetectionService') |
||
131 | ); |
||
132 | }); |
||
133 | |||
134 | // entropy |
||
135 | $container->registerService('Entropy', function ($c) { |
||
136 | return new Entropy( |
||
137 | $c->query(ILogger::class) |
||
138 | ); |
||
139 | }); |
||
140 | |||
141 | // analyzer |
||
142 | $container->registerService('SequenceSizeAnalyzer', function ($c) { |
||
143 | return new SequenceSizeAnalyzer(); |
||
144 | }); |
||
145 | |||
146 | $container->registerService('FileTypeFunnellingAnalyzer', function ($c) { |
||
147 | return new FileTypeFunnellingAnalyzer(); |
||
148 | }); |
||
149 | |||
150 | $container->registerService('EntropyFunnellingAnalyzer', function ($c) { |
||
151 | return new EntropyFunnellingAnalyzer( |
||
152 | $c->query(ILogger::class) |
||
153 | ); |
||
154 | }); |
||
155 | |||
156 | $container->registerService('FileExtensionAnalyzer', function ($c) { |
||
157 | return new FileExtensionAnalyzer( |
||
158 | $c->query(ILogger::class), |
||
159 | $c->query(Entropy::class) |
||
160 | |||
161 | ); |
||
162 | }); |
||
163 | |||
164 | $container->registerService('SequenceAnalyzer', function ($c) { |
||
165 | return new SequenceAnalyzer( |
||
166 | $c->query(SequenceSizeAnalyzer::class), |
||
167 | $c->query(FileTypeFunnellingAnalyzer::class), |
||
168 | $c->query(EntropyFunnellingAnalyzer::class) |
||
169 | ); |
||
170 | }); |
||
171 | |||
172 | $container->registerService('EntropyAnalyzer', function ($c) { |
||
173 | return new EntropyAnalyzer( |
||
174 | $c->query(ILogger::class), |
||
175 | $c->query(IRootFolder::class), |
||
176 | $c->query(Entropy::class), |
||
177 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
||
178 | ); |
||
179 | }); |
||
180 | |||
181 | $container->registerService('FileCorruptionAnalyzer', function ($c) { |
||
182 | return new FileCorruptionAnalyzer( |
||
183 | $c->query(ILogger::class), |
||
184 | $c->query(IRootFolder::class), |
||
185 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
||
186 | ); |
||
187 | }); |
||
188 | |||
189 | $container->registerService('Monitor', function ($c) { |
||
190 | return new Monitor( |
||
191 | $c->query(IRequest::class), |
||
192 | $c->query(IConfig::class), |
||
193 | $c->query(ITimeFactory::class), |
||
194 | $c->query(IAppManager::class), |
||
195 | $c->query(ILogger::class), |
||
196 | $c->query(IRootFolder::class), |
||
197 | $c->query(EntropyAnalyzer::class), |
||
198 | $c->query(FileOperationMapper::class), |
||
199 | $c->query(FileExtensionAnalyzer::class), |
||
200 | $c->query(FileCorruptionAnalyzer::class), |
||
201 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
||
202 | ); |
||
203 | }); |
||
204 | |||
205 | $container->registerService('FilesEvents', function ($c) { |
||
206 | return new FilesEvents( |
||
207 | $c->query(ILogger::class), |
||
208 | $c->query(Monitor::class), |
||
209 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
||
210 | ); |
||
247 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths