Passed
Push — master ( b4b724...0a9272 )
by Matthias
09:03 queued 11s
created

Monitor   B

Complexity

Total Complexity 43

Size/Duplication

Total Lines 432
Duplicated Lines 0 %

Importance

Changes 8
Bugs 1 Features 1
Metric Value
eloc 214
c 8
b 1
f 1
dl 0
loc 432
rs 8.96
wmc 43

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 24 1
A getFileSize() 0 19 4
A addFolderOperation() 0 28 2
A resetProfindCount() 0 6 3
A addFileOperation() 0 36 3
A isCreatingSkeletonFiles() 0 13 5
F analyze() 0 156 19
A isUploadedFile() 0 29 6

How to fix   Complexity   

Complex Class

Complex classes like Monitor often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Monitor, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/**
4
 * @copyright Copyright (c) 2017 Matthias Held <[email protected]>
5
 * @author Matthias Held <[email protected]>
6
 * @license GNU AGPL version 3 or any later version
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License as
10
 * published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
namespace OCA\RansomwareDetection;
23
24
use OCA\RansomwareDetection\AppInfo\Application;
25
use OCA\RansomwareDetection\Analyzer\EntropyAnalyzer;
26
use OCA\RansomwareDetection\Analyzer\EntropyResult;
27
use OCA\RansomwareDetection\Analyzer\FileCorruptionAnalyzer;
28
use OCA\RansomwareDetection\Analyzer\FileExtensionAnalyzer;
29
use OCA\RansomwareDetection\Analyzer\FileExtensionResult;
30
use OCA\RansomwareDetection\Db\FileOperation;
31
use OCA\RansomwareDetection\Db\FileOperationMapper;
32
use OCP\App\IAppManager;
0 ignored issues
show
Bug introduced by
The type OCP\App\IAppManager was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
use OCP\AppFramework\Utility\ITimeFactory;
0 ignored issues
show
Bug introduced by
The type OCP\AppFramework\Utility\ITimeFactory was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
34
use OCP\Files\File;
0 ignored issues
show
Bug introduced by
The type OCP\Files\File was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
35
use OCP\Files\Folder;
0 ignored issues
show
Bug introduced by
The type OCP\Files\Folder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
36
use OCP\Files\IRootFolder;
0 ignored issues
show
Bug introduced by
The type OCP\Files\IRootFolder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
37
use OCP\Files\NotFoundException;
0 ignored issues
show
Bug introduced by
The type OCP\Files\NotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
38
use OCP\Files\Storage\IStorage;
0 ignored issues
show
Bug introduced by
The type OCP\Files\Storage\IStorage was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
39
use OCP\Notification\IManager;
0 ignored issues
show
Bug introduced by
The type OCP\Notification\IManager was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
use OCP\IConfig;
0 ignored issues
show
Bug introduced by
The type OCP\IConfig was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
41
use OCP\ILogger;
0 ignored issues
show
Bug introduced by
The type OCP\ILogger was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
use OCP\IRequest;
0 ignored issues
show
Bug introduced by
The type OCP\IRequest was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
43
44
class Monitor
45
{
46
    /** File access
47
     * @var int
48
     */
49
    const DELETE = 1;
50
    const RENAME = 2;
51
    const WRITE = 3;
52
    const READ = 4;
53
    const CREATE = 5;
54
55
    /** @var IRequest */
56
    protected $request;
57
58
    /** @var IConfig */
59
    protected $config;
60
61
    /** @var ITimeFactory */
62
    protected $time;
63
64
    /** @var IAppManager */
65
    protected $appManager;
66
67
    /** @var ILogger */
68
    protected $logger;
69
70
    /** @var IRootFolder */
71
    protected $rootFolder;
72
73
    /** @var EntropyAnalyzer */
74
    protected $entropyAnalyzer;
75
76
    /** @var FileOperationMapper */
77
    protected $mapper;
78
79
    /** @var FileExtensionAnalyzer */
80
    protected $fileExtensionAnalyzer;
81
82
    /** @var FileCorruptionAnalyzer */
83
    protected $fileCorruptionAnalyzer;
84
85
    /** @var string */
86
    protected $userId;
87
88
    /** @var int */
89
    protected $nestingLevel = 0;
90
91
    /**
92
     * @param IRequest                  $request
93
     * @param IConfig                   $config
94
     * @param ITimeFactory              $time
95
     * @param IAppManager               $appManager
96
     * @param ILogger                   $logger
97
     * @param IRootFolder               $rootFolder
98
     * @param EntropyAnalyzer           $entropyAnalyzer
99
     * @param FileOperationMapper       $mapper
100
     * @param FileExtensionAnalyzer     $fileExtensionAnalyzer
101
     * @param FileCorruptionAnalyzer    $fileCorruptionAnalyzer
102
     * @param string                    $userId
103
     */
104
    public function __construct(
105
        IRequest $request,
106
        IConfig $config,
107
        ITimeFactory $time,
108
        IAppManager $appManager,
109
        ILogger $logger,
110
        IRootFolder $rootFolder,
111
        EntropyAnalyzer $entropyAnalyzer,
112
        FileOperationMapper $mapper,
113
        FileExtensionAnalyzer $fileExtensionAnalyzer,
114
        FileCorruptionAnalyzer $fileCorruptionAnalyzer,
115
        $userId
116
    ) {
117
        $this->request = $request;
118
        $this->config = $config;
119
        $this->time = $time;
120
        $this->appManager = $appManager;
121
        $this->logger = $logger;
122
        $this->rootFolder = $rootFolder;
123
        $this->entropyAnalyzer = $entropyAnalyzer;
124
        $this->mapper = $mapper;
125
        $this->fileExtensionAnalyzer = $fileExtensionAnalyzer;
126
        $this->fileCorruptionAnalyzer = $fileCorruptionAnalyzer;
127
        $this->userId = $userId;
128
    }
129
130
    /**
131
     * Analyze file.
132
     *
133
     * @param array    $paths
134
     * @param int      $mode
135
     */
136
    public function analyze($paths, $mode)
137
    {
138
        $path = $paths[0];
139
140
        $storage = $this->rootFolder->getUserFolder($this->userId)->get(dirname($path))->getStorage();
0 ignored issues
show
Unused Code introduced by
The assignment to $storage is dead and can be removed.
Loading history...
141
        if ($this->userId === null || $this->nestingLevel !== 0 || /*!$this->isUploadedFile($storage, $path) ||*/ $this->isCreatingSkeletonFiles()) {
142
            // check only cloud files and no system files
143
            return;
144
        }
145
146
        if (!$this->request->isUserAgent([
147
            IRequest::USER_AGENT_CLIENT_DESKTOP,
148
            IRequest::USER_AGENT_CLIENT_ANDROID,
149
            IRequest::USER_AGENT_CLIENT_IOS,
150
        ])) {
151
            // not a sync client
152
            return;
153
        }
154
155
        $this->nestingLevel++;
156
157
        switch ($mode) {
158
            case self::RENAME:
159
                $path = $paths[1];
160
                $this->logger->debug("Rename ".$paths[0]." to ".$paths[1], ['app' =>  Application::APP_ID]);
161
                if (preg_match('/.+\.d[0-9]+/', pathinfo($paths[1])['basename']) > 0) {
162
                    return;
163
                }
164
                // reset PROPFIND_COUNT
165
                $this->resetProfindCount();
166
167
                try {
168
                    $userRoot = $this->rootFolder->getUserFolder($this->userId);
169
                    $node = $userRoot->get($path);
170
                } catch (\OCP\Files\NotFoundException $exception) {
171
                    $this->logger->error("File Not Found ".$path, ['app' =>  Application::APP_ID]);
172
                    return;
173
                }
174
175
                // not a file no need to analyze
176
                if (!($node instanceof File)) {
177
                    $this->addFolderOperation($paths, $node, self::RENAME);
178
                    $this->nestingLevel--;
179
180
                    return;
181
                }
182
183
                $this->addFileOperation($paths, $node, self::RENAME);
184
185
                $this->nestingLevel--;
186
187
                return;
188
            case self::WRITE:
189
                $this->logger->debug("Write ".$path, ['app' =>  Application::APP_ID]);
190
                // reset PROPFIND_COUNT
191
                $this->resetProfindCount();
192
193
                try {
194
                    $userRoot = $this->rootFolder->getUserFolder($this->userId);
195
                    $node = $userRoot->get($path);
196
                } catch (\OCP\Files\NotFoundException $exception) {
197
                    $this->logger->error("File Not Found ".$path, ['app' =>  Application::APP_ID]);
198
                    return;
199
                }
200
201
                // not a file no need to analyze
202
                if (!($node instanceof File)) {
203
                    $this->addFolderOperation($paths, $node, self::WRITE);
204
                    $this->nestingLevel--;
205
206
                    return;
207
                }
208
209
                $this->addFileOperation($paths, $node, self::WRITE);
210
211
                $this->nestingLevel--;
212
213
                return;
214
            case self::READ:
215
                $this->nestingLevel--;
216
217
                return;
218
            case self::DELETE:
219
                $this->logger->debug("Delete", ['app' =>  Application::APP_ID]);
220
                // reset PROPFIND_COUNT
221
                $this->resetProfindCount();
222
223
                try {
224
                    $userRoot = $this->rootFolder->getUserFolder($this->userId);
225
                    $node = $userRoot->get($path);
226
                } catch (\OCP\Files\NotFoundException $exception) {
227
                    $this->logger->error("File Not Found ".$path, ['app' =>  Application::APP_ID]);
228
                    return;
229
                }
230
231
                // not a file no need to analyze
232
                if (!($node instanceof File)) {
233
                    $this->addFolderOperation($paths, $node, self::DELETE);
234
                    $this->nestingLevel--;
235
236
                    return;
237
                }
238
239
                $this->addFileOperation($paths, $node, self::DELETE);
240
241
                $this->nestingLevel--;
242
243
                return;
244
            case self::CREATE:
245
                $this->logger->debug("Create", ['app' =>  Application::APP_ID]);
246
                // reset PROPFIND_COUNT
247
                $this->resetProfindCount();
248
249
                try {
250
                    $userRoot = $this->rootFolder->getUserFolder($this->userId);
251
                    $node = $userRoot->get($path);
252
                } catch (\OCP\Files\NotFoundException $exception) {
253
                    $this->logger->error("File Not Found ".$path, ['app' =>  Application::APP_ID]);
254
                    return;
255
                }
256
                if (!($node instanceof File)) {
257
258
                    $fileOperation = new FileOperation();
259
                    $fileOperation->setUserId($this->userId);
260
                    $fileOperation->setPath(str_replace('files', '', pathinfo($path)['dirname']));
261
                    $fileOperation->setOriginalName(pathinfo($path)['basename']);
262
                    $fileOperation->setType('folder');
263
                    $fileOperation->setMimeType('httpd/unix-directory');
264
                    $fileOperation->setSize(0);
265
                    $fileOperation->setTimestamp(time());
266
                    $fileOperation->setCorrupted(false);
267
                    $fileOperation->setCommand(self::CREATE);
268
                    $sequenceId = $this->config->getUserValue($this->userId, Application::APP_ID, 'sequence_id', 0);
269
                    $fileOperation->setSequence($sequenceId);
270
271
                    // entropy analysis
272
                    $fileOperation->setEntropy(0.0);
273
                    $fileOperation->setStandardDeviation(0.0);
274
                    $fileOperation->setFileClass(EntropyResult::NORMAL);
275
276
                    // file extension analysis
277
                    $fileOperation->setFileExtensionClass(FileExtensionResult::NOT_SUSPICIOUS);
278
279
                    $this->mapper->insert($fileOperation);
280
                    $this->nestingLevel--;
281
                } else {
282
                    $this->addFileOperation($paths, $node, self::CREATE);
283
284
                    $this->nestingLevel--;
285
                }
286
287
                return;
288
            default:
289
                $this->nestingLevel--;
290
291
                return;
292
        }
293
    }
294
295
    /**
296
     * Check if we are in the LoginController and if so, ignore the firewall.
297
     *
298
     * @return bool
299
     */
300
    protected function isCreatingSkeletonFiles()
301
    {
302
        $exception = new \Exception();
303
        $trace = $exception->getTrace();
304
        foreach ($trace as $step) {
305
            if (isset($step['class'], $step['function']) &&
306
                $step['class'] === 'OC\Core\Controller\LoginController' &&
307
                $step['function'] === 'tryLogin') {
308
                return true;
309
            }
310
        }
311
312
        return false;
313
    }
314
315
    /**
316
     * Reset PROPFIND_COUNT.
317
     */
318
    protected function resetProfindCount()
319
    {
320
        $userKeys = $this->config->getUserKeys($this->userId, Application::APP_ID);
321
        foreach ($userKeys as $key) {
322
            if (strpos($key, 'propfind_count') !== false) {
323
                $this->config->deleteUserValue($this->userId, Application::APP_ID, $key);
324
            }
325
        }
326
    }
327
328
    /**
329
     * Return file size of a path.
330
     *
331
     * @param string $path
332
     *
333
     * @return int
334
     */
335
    private function getFileSize($path)
0 ignored issues
show
Unused Code introduced by
The method getFileSize() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
336
    {
337
        if (strpos($path, 'files_trashbin') !== false) {
338
            $node = $this->rootFolder->get($path);
339
340
            if (!($node instanceof File)) {
341
                throw new NotFoundException();
342
            }
343
344
            return $node->getSize();
345
        } else {
346
            $userRoot = $this->rootFolder->getUserFolder($this->userId)->getParent();
347
            $node = $userRoot->get($path);
348
349
            if (!($node instanceof File)) {
350
                throw new NotFoundException();
351
            }
352
353
            return $node->getSize();
354
        }
355
    }
356
357
    /**
358
     * Check if file is a uploaded file.
359
     *
360
     * @param IStorage $storage
361
     * @param string   $path
362
     *
363
     * @return bool
364
     */
365
    private function isUploadedFile(IStorage $storage, $path)
0 ignored issues
show
Unused Code introduced by
The method isUploadedFile() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
366
    {
367
        $fullPath = $path;
368
        if (property_exists($storage, 'mountPoint')) {
369
            /* @var StorageWrapper $storage */
370
            try {
371
                $fullPath = $storage->mountPoint.$path;
372
            } catch (\Exception $ex) {
0 ignored issues
show
Unused Code introduced by
catch (\Exception $ex) is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
373
                return true;
374
            }
375
        }
376
377
        // ignore transfer files
378
        if (strpos($fullPath, 'ocTransferId') > 0) {
379
            return false;
380
        }
381
382
        if (substr_count($fullPath, '/') < 3) {
383
            return false;
384
        }
385
386
        // '', admin, 'files', 'path/to/file.txt'
387
        $segment = explode('/', $fullPath, 4);
388
389
        return isset($segment[2]) && in_array($segment[2], [
390
            'files',
391
            'thumbnails',
392
            'files_versions',
393
        ], true);
394
    }
395
396
    /**
397
     * Add a folder to the operations.
398
     *
399
     * @param array $paths
400
     * @param INode $node
0 ignored issues
show
Bug introduced by
The type OCA\RansomwareDetection\INode was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
401
     * @param int   $operation
402
     */
403
    private function addFolderOperation($paths, $node, $operation)
404
    {
405
        $this->logger->debug("Add folder operation.", ['app' =>  Application::APP_ID]);
406
        $fileOperation = new FileOperation();
407
        $fileOperation->setUserId($this->userId);
408
        $fileOperation->setPath(str_replace('files', '', pathinfo($node->getInternalPath())['dirname']));
409
        $fileOperation->setOriginalName($node->getName());
410
        if ($operation === self::RENAME) {
411
            $fileOperation->setNewName(pathinfo($paths[1])['basename']);
412
        }
413
        $fileOperation->setType('folder');
414
        $fileOperation->setMimeType($node->getMimeType());
415
        $fileOperation->setSize(0);
416
        $fileOperation->setTimestamp(time());
417
        $fileOperation->setCorrupted(false);
418
        $fileOperation->setCommand($operation);
419
        $sequenceId = $this->config->getUserValue($this->userId, Application::APP_ID, 'sequence_id', 0);
420
        $fileOperation->setSequence($sequenceId);
421
422
        // entropy analysis
423
        $fileOperation->setEntropy(0.0);
424
        $fileOperation->setStandardDeviation(0.0);
425
        $fileOperation->setFileClass(EntropyResult::NORMAL);
426
427
        // file extension analysis
428
        $fileOperation->setFileExtensionClass(FileExtensionResult::NOT_SUSPICIOUS);
429
430
        $this->mapper->insert($fileOperation);
431
    }
432
433
    /**
434
     * Add a file to the operations.
435
     *
436
     * @param array $paths
437
     * @param INode $node
438
     * @param int   $operation
439
     */
440
    private function addFileOperation($paths, $node, $operation)
441
    {
442
        $this->logger->debug("Add file operation.", ['app' =>  Application::APP_ID]);
443
        $fileOperation = new FileOperation();
444
        $fileOperation->setUserId($this->userId);
445
        $fileOperation->setPath(str_replace('files', '', pathinfo($node->getInternalPath())['dirname']));
446
        $fileOperation->setOriginalName($node->getName());
447
        if ($operation === self::RENAME) {
448
            $fileOperation->setNewName(pathinfo($paths[1])['basename']);
449
        }
450
        $fileOperation->setType('file');
451
        $fileOperation->setMimeType($node->getMimeType());
452
        $fileOperation->setSize($node->getSize());
453
        $fileOperation->setTimestamp(time());
454
        $fileOperation->setCommand($operation);
455
        $sequenceId = $this->config->getUserValue($this->userId, Application::APP_ID, 'sequence_id', 0);
456
        $fileOperation->setSequence($sequenceId);
457
458
        // file extension analysis
459
        $fileExtensionResult = $this->fileExtensionAnalyzer->analyze($node->getInternalPath());
460
        $fileOperation->setFileExtensionClass($fileExtensionResult->getFileExtensionClass());
461
462
        $fileCorruptionResult = $this->fileCorruptionAnalyzer->analyze($node);
463
        $isCorrupted = $fileCorruptionResult->isCorrupted();
464
        $fileOperation->setCorrupted($isCorrupted);
465
        if ($isCorrupted) {
466
            $fileOperation->setFileExtensionClass(FileExtensionResult::SUSPICIOUS);
467
        }
468
469
        // entropy analysis
470
        $entropyResult = $this->entropyAnalyzer->analyze($node);
471
        $fileOperation->setEntropy($entropyResult->getEntropy());
472
        $fileOperation->setStandardDeviation($entropyResult->getStandardDeviation());
473
        $fileOperation->setFileClass($entropyResult->getFileClass());
474
475
        $entity = $this->mapper->insert($fileOperation);
0 ignored issues
show
Unused Code introduced by
The assignment to $entity is dead and can be removed.
Loading history...
476
    }
477
}
478