| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * Copyright (c) 2015 Viktar 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 \OCP\AppFramework\App; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use OCA\Files_Antivirus\AppConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use OCA\Files_Antivirus\Controller\RuleController; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use OCA\Files_Antivirus\Controller\SettingsController; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use OCA\Files_Antivirus\Db\RuleMapper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use OCA\Files_Antivirus\BackgroundScanner; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use OCA\Files_Antivirus\RequestHelper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use OCA\Files_Antivirus\ScannerFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use \OCA\Files_Antivirus\AvirWrapper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | class Application extends App { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 26 |  | 	public function __construct (array $urlParams = array()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 26 |  | 		parent::__construct('files_antivirus', $urlParams); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 		 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 | 26 |  | 		$container = $this->getContainer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 | 26 |  | 			'RuleController', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 				return new RuleController( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 					$c->query('AppName'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 					$c->query('Request'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 					$c->query('Logger'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 					$c->query('L10N'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 					$c->query('RuleMapper') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 26 |  | 			'SettingsController', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 				return new SettingsController( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 					$c->query('Request'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 					$c->query('AppConfig'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 					$c->query('ScannerFactory'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 					$c->query('L10N') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 26 |  | 			'AppConfig', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 7 |  | 				return new AppConfig( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 | 7 |  | 					$c->query('CoreConfig') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 26 |  | 			'ScannerFactory', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 1 |  | 				return new ScannerFactory( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 | 1 |  | 					$c->query('AppConfig'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 1 |  | 					$c->query('Logger') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 		 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 26 |  | 			'BackgroundScanner', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 				return new BackgroundScanner( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 					$c->query('ScannerFactory'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 					$c->query('L10N'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 					$c->query('AppConfig'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 					$c->getServer()->getRootFolder(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 					$c->getServer()->getUserSession() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 | 26 |  | 			'RuleMapper', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 				return new RuleMapper( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 					$c->query('ServerContainer')->getDb() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 | 26 |  | 			'RequestHelper', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 | 2 |  | 				return new RequestHelper( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 2 |  | 					$c->query('ServerContainer')->getRequest() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 		 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 		 * Core | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 | 26 |  | 			'Logger', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 15 |  | 				return $c->query('ServerContainer')->getLogger(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 26 |  | 			'CoreConfig', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 | 12 |  | 				return $c->query('ServerContainer')->getConfig(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 | 26 |  | 		$container->registerService( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 | 26 |  | 			'L10N', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 			function ($c) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 | 1 |  | 				return $c->query('ServerContainer')->getL10N($c->query('AppName')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 | 26 |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 26 |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 	 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 	 * Add wrapper for local storages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 	 * @return void | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 128 |  |  | 	 */ | 
            
                                                        
            
                                    
            
            
                | 129 | 3 |  | 	public function setupWrapper() { | 
            
                                                        
            
                                    
            
            
                | 130 | 3 |  | 		\OC\Files\Filesystem::addStorageWrapper( | 
            
                                                        
            
                                    
            
            
                | 131 | 3 |  | 			'oc_avir', | 
            
                                                        
            
                                    
            
            
                | 132 | 3 |  | 			function ($mountPoint, $storage) { | 
            
                                                        
            
                                    
            
            
                | 133 |  |  | 				/** | 
            
                                                        
            
                                    
            
            
                | 134 |  |  | 				 * @var \OC\Files\Storage\Storage $storage | 
            
                                                        
            
                                    
            
            
                | 135 |  |  | 				 */ | 
            
                                                        
            
                                    
            
            
                | 136 | 3 |  | 				if ($storage instanceof \OC\Files\Storage\Storage) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 137 | 3 |  | 					$appConfig = $this->getContainer()->query('AppConfig'); | 
            
                                                        
            
                                    
            
            
                | 138 | 3 |  | 					$scannerFactory = $this->getContainer()->query('ScannerFactory'); | 
            
                                                        
            
                                    
            
            
                | 139 | 3 |  | 					$l10n = $this->getContainer()->query('L10N'); | 
            
                                                        
            
                                    
            
            
                | 140 | 3 |  | 					$logger = $this->getContainer()->query('Logger'); | 
            
                                                        
            
                                    
            
            
                | 141 | 3 |  | 					$requestHelper = $this->getContainer()->query('RequestHelper'); | 
            
                                                        
            
                                    
            
            
                | 142 | 3 |  | 					return new AvirWrapper( | 
            
                                                        
            
                                    
            
            
                | 143 |  |  | 						[ | 
            
                                                        
            
                                    
            
            
                | 144 | 3 |  | 							'storage' => $storage, | 
            
                                                        
            
                                    
            
            
                | 145 | 3 |  | 							'appConfig' => $appConfig, | 
            
                                                        
            
                                    
            
            
                | 146 | 3 |  | 							'scannerFactory' => $scannerFactory, | 
            
                                                        
            
                                    
            
            
                | 147 | 3 |  | 							'l10n' => $l10n, | 
            
                                                        
            
                                    
            
            
                | 148 | 3 |  | 							'logger' => $logger, | 
            
                                                        
            
                                    
            
            
                | 149 | 3 |  | 							'requestHelper' => $requestHelper | 
            
                                                        
            
                                    
            
            
                | 150 |  |  | 						] | 
            
                                                        
            
                                    
            
            
                | 151 |  |  | 					); | 
            
                                                        
            
                                    
            
            
                | 152 |  |  | 				} else { | 
            
                                                        
            
                                    
            
            
                | 153 |  |  | 					return $storage; | 
            
                                                        
            
                                    
            
            
                | 154 |  |  | 				} | 
            
                                                        
            
                                    
            
            
                | 155 | 3 |  | 			}, | 
            
                                                        
            
                                    
            
            
                | 156 | 3 |  | 			1 | 
            
                                                        
            
                                    
            
            
                | 157 |  |  | 		); | 
            
                                                        
            
                                    
            
            
                | 158 | 3 |  | 	} | 
            
                                                        
            
                                    
            
            
                | 159 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 160 |  |  |  | 
            
                        
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto 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
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.