1 | <?php |
||||
2 | /** |
||||
3 | * @copyright Copyright (c) 2019 Matthias Held <[email protected]> |
||||
4 | * @author Matthias Held <[email protected]> |
||||
5 | * @license GNU AGPL version 3 or any later version |
||||
6 | * |
||||
7 | * This program is free software: you can redistribute it and/or modify |
||||
8 | * it under the terms of the GNU Affero General Public License as |
||||
9 | * published by the Free Software Foundation, either version 3 of the |
||||
10 | * License, or (at your option) any later version. |
||||
11 | * |
||||
12 | * This program is distributed in the hope that it will be useful, |
||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
15 | * GNU Affero General Public License for more details. |
||||
16 | * |
||||
17 | * You should have received a copy of the GNU Affero General Public License |
||||
18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
19 | */ |
||||
20 | |||||
21 | namespace OCA\RansomwareDetection\Model; |
||||
22 | |||||
23 | use OCA\RansomwareDetection\Db\FileOperationMapper; |
||||
24 | |||||
25 | class DetectionDeserializer { |
||||
26 | |||||
27 | /** @var FileOperationMapper */ |
||||
28 | protected $mapper; |
||||
29 | |||||
30 | /** |
||||
31 | * @param FileOperationMapper $mapper |
||||
32 | */ |
||||
33 | public function __construct( |
||||
34 | FileOperationMapper $mapper |
||||
35 | ) { |
||||
36 | $this->mapper = $mapper; |
||||
37 | } |
||||
38 | |||||
39 | public function deserialize($json) { |
||||
40 | $detection = new Detection(); |
||||
0 ignored issues
–
show
|
|||||
41 | $detection->setId($json['id']); |
||||
42 | foreach ($json['fileOperations'] as $fileOperation) { |
||||
43 | $detection->addFileOperation($this->mapper->find($fileOperation->getId())); |
||||
0 ignored issues
–
show
The call to
OCA\RansomwareDetection\...OperationMapper::find() has too few arguments starting with userId .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
44 | } |
||||
45 | return $detection; |
||||
46 | } |
||||
47 | } |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.