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 <http://www.gnu.org/licenses/>. |
||||||||||
20 | */ |
||||||||||
21 | |||||||||||
22 | namespace OCA\RansomwareDetection; |
||||||||||
23 | |||||||||||
24 | use OC\Files\Cache\Wrapper\CacheWrapper as Wrapper; |
||||||||||
0 ignored issues
–
show
|
|||||||||||
25 | use OCP\Constants; |
||||||||||
0 ignored issues
–
show
The type
OCP\Constants 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||||||
26 | use OCP\Files\Cache\ICache; |
||||||||||
0 ignored issues
–
show
The type
OCP\Files\Cache\ICache 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||||||
27 | use OCP\Files\Storage\IStorage; |
||||||||||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||||||
28 | |||||||||||
29 | class CacheWrapper extends Wrapper |
||||||||||
30 | { |
||||||||||
31 | /** @var Monitor */ |
||||||||||
32 | protected $monitor; |
||||||||||
33 | |||||||||||
34 | /** @var StorageWrapper */ |
||||||||||
0 ignored issues
–
show
The type
OCA\RansomwareDetection\StorageWrapper 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||||||
35 | protected $storage; |
||||||||||
36 | |||||||||||
37 | /** @var int */ |
||||||||||
38 | protected $mask; |
||||||||||
39 | |||||||||||
40 | /** |
||||||||||
41 | * @param ICache $cache |
||||||||||
42 | * @param IStorage $storage |
||||||||||
43 | * @param Monitor $monitor |
||||||||||
44 | */ |
||||||||||
45 | public function __construct( |
||||||||||
46 | ICache $cache, |
||||||||||
47 | IStorage $storage, |
||||||||||
48 | Monitor $monitor |
||||||||||
49 | ) { |
||||||||||
50 | parent::__construct($cache); |
||||||||||
51 | $this->storage = $storage; |
||||||||||
52 | $this->monitor = $monitor; |
||||||||||
53 | $this->mask = Constants::PERMISSION_ALL; |
||||||||||
54 | $this->mask &= ~Constants::PERMISSION_READ; |
||||||||||
55 | $this->mask &= ~Constants::PERMISSION_CREATE; |
||||||||||
56 | $this->mask &= ~Constants::PERMISSION_UPDATE; |
||||||||||
57 | } |
||||||||||
58 | |||||||||||
59 | protected function formatCacheEntry($entry) |
||||||||||
60 | { |
||||||||||
61 | if (isset($entry['path'])) { |
||||||||||
62 | $this->monitor->analyze($this->storage, [$entry['path']], Monitor::READ); |
||||||||||
0 ignored issues
–
show
The call to
OCA\RansomwareDetection\Monitor::analyze() has too many arguments starting with OCA\RansomwareDetection\Monitor::READ .
(
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 more 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. ![]() $this->storage of type OCA\RansomwareDetection\StorageWrapper is incompatible with the type array expected by parameter $paths of OCA\RansomwareDetection\Monitor::analyze() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() array($entry['path']) of type array is incompatible with the type integer expected by parameter $mode of OCA\RansomwareDetection\Monitor::analyze() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||||
63 | } |
||||||||||
64 | |||||||||||
65 | return $entry; |
||||||||||
66 | } |
||||||||||
67 | } |
||||||||||
68 |
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