Completed
Push — master ( 47e965...69fd96 )
by
unknown
04:26
created

Application::setupWrapper()   B

Complexity

Conditions 2
Paths 1

Size

Total Lines 27
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 2.0005

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 19
cts 20
cp 0.95
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 18
nc 1
nop 0
crap 2.0005
1
<?php
2
/**
3
 * Copyright (c) 2015 Victor Dubiniuk <[email protected]>
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later.
6
 * See the COPYING-README file.
7
 */
8
9
namespace OCA\Files_Antivirus\AppInfo;
10
11
use OCA\Files_Antivirus\AvirWrapper;
12
use OCA\Files_Antivirus\Scanner\ScannerFactory;
13
use OCP\Activity\IManager;
14
use OCP\AppFramework\App;
15
use OCP\IL10N;
16
use OCP\ILogger;
17
18
class Application extends App {
19
20
	const APP_NAME = 'files_antivirus';
21
22 5
	public function __construct (array $urlParams = []) {
23 5
		parent::__construct(self::APP_NAME, $urlParams);
24 5
	}
25
	
26
	/**
27
	 * Add wrapper for local storages
28
	 */
29 1
	public function setupWrapper(){
30 1
		\OC\Files\Filesystem::addStorageWrapper(
31 1
			'oc_avir',
32 1
			function ($mountPoint, $storage) {
33
				/**
34
				 * @var \OC\Files\Storage\Storage $storage
35
				 */
36 1
				if ($storage instanceof \OC\Files\Storage\Storage) {
0 ignored issues
show
Bug introduced by
The class OC\Files\Storage\Storage does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
37 1
					$container = $this->getContainer();
38 1
					$scannerFactory = $container->query(ScannerFactory::class);
39 1
					$l10n = $container->query(IL10N::class);
40 1
					$logger = $container->query(ILogger::class);
41 1
					$activityManager = $container->query(IManager::class);
42 1
					return new AvirWrapper([
43 1
						'storage' => $storage,
44 1
						'scannerFactory' => $scannerFactory,
45 1
						'l10n' => $l10n,
46 1
						'logger' => $logger,
47 1
						'activityManager' => $activityManager,
48
					]);
49
				}
50
51
				return $storage;
52 1
			},
53 1
			1
54
		);
55 1
	}
56
}
57