Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like OC_App 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 OC_App, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 64 | class OC_App { |
||
|
|
|||
| 65 | static private $adminForms = array(); |
||
| 66 | static private $personalForms = array(); |
||
| 67 | static private $appTypes = array(); |
||
| 68 | static private $loadedApps = array(); |
||
| 69 | static private $altLogin = array(); |
||
| 70 | static private $alreadyRegistered = []; |
||
| 71 | const officialApp = 200; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * clean the appId |
||
| 75 | * |
||
| 76 | * @param string|boolean $app AppId that needs to be cleaned |
||
| 77 | * @return string |
||
| 78 | */ |
||
| 79 | public static function cleanAppId($app) { |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Check if an app is loaded |
||
| 85 | * |
||
| 86 | * @param string $app |
||
| 87 | * @return bool |
||
| 88 | */ |
||
| 89 | public static function isAppLoaded($app) { |
||
| 92 | |||
| 93 | /** |
||
| 94 | * loads all apps |
||
| 95 | * |
||
| 96 | * @param string[] | string | null $types |
||
| 97 | * @return bool |
||
| 98 | * |
||
| 99 | * This function walks through the ownCloud directory and loads all apps |
||
| 100 | * it can find. A directory contains an app if the file /appinfo/info.xml |
||
| 101 | * exists. |
||
| 102 | * |
||
| 103 | * if $types is set, only apps of those types will be loaded |
||
| 104 | */ |
||
| 105 | public static function loadApps($types = null) { |
||
| 131 | |||
| 132 | /** |
||
| 133 | * load a single app |
||
| 134 | * |
||
| 135 | * @param string $app |
||
| 136 | * @throws Exception |
||
| 137 | */ |
||
| 138 | public static function loadApp($app) { |
||
| 139 | self::$loadedApps[] = $app; |
||
| 140 | $appPath = self::getAppPath($app); |
||
| 141 | if($appPath === false) { |
||
| 142 | return; |
||
| 143 | } |
||
| 144 | |||
| 145 | // in case someone calls loadApp() directly |
||
| 146 | self::registerAutoloading($app, $appPath); |
||
| 147 | |||
| 148 | if (is_file($appPath . '/appinfo/app.php')) { |
||
| 149 | \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); |
||
| 150 | try { |
||
| 151 | self::requireAppFile($app); |
||
| 152 | } catch (Error $ex) { |
||
| 153 | \OC::$server->getLogger()->logException($ex); |
||
| 154 | if (!\OC::$server->getAppManager()->isShipped($app)) { |
||
| 155 | // Only disable apps which are not shipped |
||
| 156 | self::disable($app); |
||
| 157 | } |
||
| 158 | } |
||
| 159 | if (self::isType($app, array('authentication'))) { |
||
| 160 | // since authentication apps affect the "is app enabled for group" check, |
||
| 161 | // the enabled apps cache needs to be cleared to make sure that the |
||
| 162 | // next time getEnableApps() is called it will also include apps that were |
||
| 163 | // enabled for groups |
||
| 164 | self::$enabledAppsCache = array(); |
||
| 165 | } |
||
| 166 | \OC::$server->getEventLogger()->end('load_app_' . $app); |
||
| 167 | } |
||
| 168 | |||
| 169 | $info = self::getAppInfo($app); |
||
| 170 | View Code Duplication | if (!empty($info['activity']['filters'])) { |
|
| 171 | foreach ($info['activity']['filters'] as $filter) { |
||
| 172 | \OC::$server->getActivityManager()->registerFilter($filter); |
||
| 173 | } |
||
| 174 | } |
||
| 175 | View Code Duplication | if (!empty($info['activity']['settings'])) { |
|
| 176 | foreach ($info['activity']['settings'] as $setting) { |
||
| 177 | \OC::$server->getActivityManager()->registerSetting($setting); |
||
| 178 | } |
||
| 179 | } |
||
| 180 | View Code Duplication | if (!empty($info['activity']['providers'])) { |
|
| 181 | foreach ($info['activity']['providers'] as $provider) { |
||
| 182 | \OC::$server->getActivityManager()->registerProvider($provider); |
||
| 183 | } |
||
| 184 | } |
||
| 185 | |||
| 186 | View Code Duplication | if (!empty($info['settings']['admin'])) { |
|
| 187 | foreach ($info['settings']['admin'] as $setting) { |
||
| 188 | \OC::$server->getSettingsManager()->registerSetting('admin', $setting); |
||
| 189 | } |
||
| 190 | } |
||
| 191 | if (!empty($info['settings']['admin-section'])) { |
||
| 192 | foreach ($info['settings']['admin-section'] as $section) { |
||
| 193 | \OC::$server->getSettingsManager()->registerSection('admin', $section); |
||
| 194 | } |
||
| 195 | } |
||
| 196 | if (!empty($info['settings']['personal'])) { |
||
| 197 | foreach ($info['settings']['personal'] as $setting) { |
||
| 198 | \OC::$server->getSettingsManager()->registerSetting('personal', $setting); |
||
| 199 | } |
||
| 200 | } |
||
| 201 | if (!empty($info['settings']['personal-section'])) { |
||
| 202 | foreach ($info['settings']['personal-section'] as $section) { |
||
| 203 | \OC::$server->getSettingsManager()->registerSection('personal', $section); |
||
| 204 | } |
||
| 205 | } |
||
| 206 | |||
| 207 | if (!empty($info['collaboration']['plugins'])) { |
||
| 208 | // deal with one or many plugin entries |
||
| 209 | $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ? |
||
| 210 | [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
||
| 211 | foreach ($plugins as $plugin) { |
||
| 212 | if($plugin['@attributes']['type'] === 'collaborator-search') { |
||
| 213 | $pluginInfo = [ |
||
| 214 | 'shareType' => $plugin['@attributes']['share-type'], |
||
| 215 | 'class' => $plugin['@value'], |
||
| 216 | ]; |
||
| 217 | \OC::$server->getCollaboratorSearch()->registerPlugin($pluginInfo); |
||
| 218 | } else if ($plugin['@attributes']['type'] === 'autocomplete-sort') { |
||
| 219 | \OC::$server->getAutoCompleteManager()->registerSorter($plugin['@value']); |
||
| 220 | } |
||
| 221 | } |
||
| 222 | } |
||
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
| 226 | * @internal |
||
| 227 | * @param string $app |
||
| 228 | * @param string $path |
||
| 229 | */ |
||
| 230 | public static function registerAutoloading($app, $path) { |
||
| 231 | $key = $app . '-' . $path; |
||
| 232 | if(isset(self::$alreadyRegistered[$key])) { |
||
| 233 | return; |
||
| 234 | } |
||
| 235 | |||
| 236 | self::$alreadyRegistered[$key] = true; |
||
| 237 | |||
| 238 | // Register on PSR-4 composer autoloader |
||
| 239 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
||
| 240 | \OC::$server->registerNamespace($app, $appNamespace); |
||
| 241 | |||
| 242 | if (file_exists($path . '/composer/autoload.php')) { |
||
| 243 | require_once $path . '/composer/autoload.php'; |
||
| 244 | } else { |
||
| 245 | \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
||
| 246 | // Register on legacy autoloader |
||
| 247 | \OC::$loader->addValidRoot($path); |
||
| 248 | } |
||
| 249 | |||
| 250 | // Register Test namespace only when testing |
||
| 251 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
||
| 252 | \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
||
| 253 | } |
||
| 254 | } |
||
| 255 | |||
| 256 | /** |
||
| 257 | * Load app.php from the given app |
||
| 258 | * |
||
| 259 | * @param string $app app name |
||
| 260 | * @throws Error |
||
| 261 | */ |
||
| 262 | private static function requireAppFile($app) { |
||
| 263 | // encapsulated here to avoid variable scope conflicts |
||
| 264 | require_once $app . '/appinfo/app.php'; |
||
| 265 | } |
||
| 266 | |||
| 267 | /** |
||
| 268 | * check if an app is of a specific type |
||
| 269 | * |
||
| 270 | * @param string $app |
||
| 271 | * @param string|array $types |
||
| 272 | * @return bool |
||
| 273 | */ |
||
| 274 | public static function isType($app, $types) { |
||
| 275 | if (is_string($types)) { |
||
| 276 | $types = array($types); |
||
| 277 | } |
||
| 278 | $appTypes = self::getAppTypes($app); |
||
| 279 | foreach ($types as $type) { |
||
| 280 | if (array_search($type, $appTypes) !== false) { |
||
| 281 | return true; |
||
| 282 | } |
||
| 283 | } |
||
| 284 | return false; |
||
| 285 | } |
||
| 286 | |||
| 287 | /** |
||
| 288 | * get the types of an app |
||
| 289 | * |
||
| 290 | * @param string $app |
||
| 291 | * @return array |
||
| 292 | */ |
||
| 293 | private static function getAppTypes($app) { |
||
| 294 | //load the cache |
||
| 295 | if (count(self::$appTypes) == 0) { |
||
| 296 | self::$appTypes = \OC::$server->getAppConfig()->getValues(false, 'types'); |
||
| 297 | } |
||
| 298 | |||
| 299 | if (isset(self::$appTypes[$app])) { |
||
| 300 | return explode(',', self::$appTypes[$app]); |
||
| 301 | } else { |
||
| 302 | return array(); |
||
| 303 | } |
||
| 304 | } |
||
| 305 | |||
| 306 | /** |
||
| 307 | * read app types from info.xml and cache them in the database |
||
| 308 | */ |
||
| 309 | public static function setAppTypes($app) { |
||
| 310 | $appData = self::getAppInfo($app); |
||
| 311 | if(!is_array($appData)) { |
||
| 312 | return; |
||
| 313 | } |
||
| 314 | |||
| 315 | if (isset($appData['types'])) { |
||
| 316 | $appTypes = implode(',', $appData['types']); |
||
| 317 | } else { |
||
| 318 | $appTypes = ''; |
||
| 319 | $appData['types'] = []; |
||
| 320 | } |
||
| 321 | |||
| 322 | \OC::$server->getConfig()->setAppValue($app, 'types', $appTypes); |
||
| 323 | |||
| 324 | if (\OC::$server->getAppManager()->hasProtectedAppType($appData['types'])) { |
||
| 325 | $enabled = \OC::$server->getConfig()->getAppValue($app, 'enabled', 'yes'); |
||
| 326 | if ($enabled !== 'yes' && $enabled !== 'no') { |
||
| 327 | \OC::$server->getConfig()->setAppValue($app, 'enabled', 'yes'); |
||
| 328 | } |
||
| 329 | } |
||
| 330 | } |
||
| 331 | |||
| 332 | /** |
||
| 333 | * get all enabled apps |
||
| 334 | */ |
||
| 335 | protected static $enabledAppsCache = array(); |
||
| 336 | |||
| 337 | /** |
||
| 338 | * Returns apps enabled for the current user. |
||
| 339 | * |
||
| 340 | * @param bool $forceRefresh whether to refresh the cache |
||
| 341 | * @param bool $all whether to return apps for all users, not only the |
||
| 342 | * currently logged in one |
||
| 343 | * @return string[] |
||
| 344 | */ |
||
| 345 | public static function getEnabledApps($forceRefresh = false, $all = false) { |
||
| 346 | if (!\OC::$server->getSystemConfig()->getValue('installed', false)) { |
||
| 347 | return array(); |
||
| 348 | } |
||
| 349 | // in incognito mode or when logged out, $user will be false, |
||
| 350 | // which is also the case during an upgrade |
||
| 351 | $appManager = \OC::$server->getAppManager(); |
||
| 352 | if ($all) { |
||
| 353 | $user = null; |
||
| 354 | } else { |
||
| 355 | $user = \OC::$server->getUserSession()->getUser(); |
||
| 356 | } |
||
| 357 | |||
| 358 | if (is_null($user)) { |
||
| 359 | $apps = $appManager->getInstalledApps(); |
||
| 360 | } else { |
||
| 361 | $apps = $appManager->getEnabledAppsForUser($user); |
||
| 362 | } |
||
| 363 | $apps = array_filter($apps, function ($app) { |
||
| 364 | return $app !== 'files';//we add this manually |
||
| 365 | }); |
||
| 366 | sort($apps); |
||
| 367 | array_unshift($apps, 'files'); |
||
| 368 | return $apps; |
||
| 369 | } |
||
| 370 | |||
| 371 | /** |
||
| 372 | * checks whether or not an app is enabled |
||
| 373 | * |
||
| 374 | * @param string $app app |
||
| 375 | * @return bool |
||
| 376 | * @deprecated 13.0.0 use \OC::$server->getAppManager()->isEnabledForUser($appId) |
||
| 377 | * |
||
| 378 | * This function checks whether or not an app is enabled. |
||
| 379 | */ |
||
| 380 | public static function isEnabled($app) { |
||
| 381 | return \OC::$server->getAppManager()->isEnabledForUser($app); |
||
| 382 | } |
||
| 383 | |||
| 384 | /** |
||
| 385 | * enables an app |
||
| 386 | * |
||
| 387 | * @param string $appId |
||
| 388 | * @param array $groups (optional) when set, only these groups will have access to the app |
||
| 389 | * @throws \Exception |
||
| 390 | * @return void |
||
| 391 | * |
||
| 392 | * This function set an app as enabled in appconfig. |
||
| 393 | */ |
||
| 394 | public function enable($appId, |
||
| 395 | $groups = null) { |
||
| 396 | self::$enabledAppsCache = []; // flush |
||
| 397 | |||
| 398 | // Check if app is already downloaded |
||
| 399 | $installer = \OC::$server->query(Installer::class); |
||
| 400 | $isDownloaded = $installer->isDownloaded($appId); |
||
| 401 | |||
| 402 | if(!$isDownloaded) { |
||
| 403 | $installer->downloadApp($appId); |
||
| 404 | } |
||
| 405 | |||
| 406 | $installer->installApp($appId); |
||
| 407 | |||
| 408 | $appManager = \OC::$server->getAppManager(); |
||
| 409 | if (!is_null($groups)) { |
||
| 410 | $groupManager = \OC::$server->getGroupManager(); |
||
| 411 | $groupsList = []; |
||
| 412 | foreach ($groups as $group) { |
||
| 413 | $groupItem = $groupManager->get($group); |
||
| 414 | if ($groupItem instanceof \OCP\IGroup) { |
||
| 415 | $groupsList[] = $groupManager->get($group); |
||
| 416 | } |
||
| 417 | } |
||
| 418 | $appManager->enableAppForGroups($appId, $groupsList); |
||
| 419 | } else { |
||
| 420 | $appManager->enableApp($appId); |
||
| 421 | } |
||
| 422 | } |
||
| 423 | |||
| 424 | /** |
||
| 425 | * This function set an app as disabled in appconfig. |
||
| 426 | * |
||
| 427 | * @param string $app app |
||
| 428 | * @throws Exception |
||
| 429 | */ |
||
| 430 | public static function disable($app) { |
||
| 447 | |||
| 448 | /** |
||
| 449 | * Get the path where to install apps |
||
| 450 | * |
||
| 451 | * @return string|false |
||
| 452 | */ |
||
| 453 | public static function getInstallPath() { |
||
| 454 | if (\OC::$server->getSystemConfig()->getValue('appstoreenabled', true) == false) { |
||
| 455 | return false; |
||
| 456 | } |
||
| 467 | |||
| 468 | |||
| 469 | /** |
||
| 470 | * search for an app in all app-directories |
||
| 471 | * |
||
| 472 | * @param string $appId |
||
| 473 | * @return false|string |
||
| 474 | */ |
||
| 475 | public static function findAppInDirectories($appId) { |
||
| 515 | |||
| 516 | /** |
||
| 517 | * Get the directory for the given app. |
||
| 518 | * If the app is defined in multiple directories, the first one is taken. (false if not found) |
||
| 519 | * |
||
| 520 | * @param string $appId |
||
| 521 | * @return string|false |
||
| 522 | */ |
||
| 523 | public static function getAppPath($appId) { |
||
| 533 | |||
| 534 | /** |
||
| 535 | * Get the path for the given app on the access |
||
| 536 | * If the app is defined in multiple directories, the first one is taken. (false if not found) |
||
| 537 | * |
||
| 538 | * @param string $appId |
||
| 539 | * @return string|false |
||
| 540 | */ |
||
| 541 | public static function getAppWebPath($appId) { |
||
| 547 | |||
| 548 | /** |
||
| 549 | * get the last version of the app from appinfo/info.xml |
||
| 550 | * |
||
| 551 | * @param string $appId |
||
| 552 | * @param bool $useCache |
||
| 553 | * @return string |
||
| 554 | * @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppVersion() |
||
| 555 | */ |
||
| 556 | public static function getAppVersion($appId, $useCache = true) { |
||
| 559 | |||
| 560 | /** |
||
| 561 | * get app's version based on it's path |
||
| 562 | * |
||
| 563 | * @param string $path |
||
| 564 | * @return string |
||
| 565 | */ |
||
| 566 | public static function getAppVersionByPath($path) { |
||
| 571 | |||
| 572 | |||
| 573 | /** |
||
| 574 | * Read all app metadata from the info.xml file |
||
| 575 | * |
||
| 576 | * @param string $appId id of the app or the path of the info.xml file |
||
| 577 | * @param bool $path |
||
| 578 | * @param string $lang |
||
| 579 | * @return array|null |
||
| 580 | * @note all data is read from info.xml, not just pre-defined fields |
||
| 581 | * @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppInfo() |
||
| 582 | */ |
||
| 583 | public static function getAppInfo($appId, $path = false, $lang = null) { |
||
| 586 | |||
| 587 | /** |
||
| 588 | * Returns the navigation |
||
| 589 | * |
||
| 590 | * @return array |
||
| 591 | * @deprecated 14.0.0 use \OC::$server->getNavigationManager()->getAll() |
||
| 592 | * |
||
| 593 | * This function returns an array containing all entries added. The |
||
| 594 | * entries are sorted by the key 'order' ascending. Additional to the keys |
||
| 595 | * given for each app the following keys exist: |
||
| 596 | * - active: boolean, signals if the user is on this navigation entry |
||
| 597 | */ |
||
| 598 | public static function getNavigation() { |
||
| 601 | |||
| 602 | /** |
||
| 603 | * Returns the Settings Navigation |
||
| 604 | * |
||
| 605 | * @return string[] |
||
| 606 | * @deprecated 14.0.0 use \OC::$server->getNavigationManager()->getAll('settings') |
||
| 607 | * |
||
| 608 | * This function returns an array containing all settings pages added. The |
||
| 609 | * entries are sorted by the key 'order' ascending. |
||
| 610 | */ |
||
| 611 | public static function getSettingsNavigation() { |
||
| 614 | |||
| 615 | /** |
||
| 616 | * get the id of loaded app |
||
| 617 | * |
||
| 618 | * @return string |
||
| 619 | */ |
||
| 620 | public static function getCurrentApp() { |
||
| 637 | |||
| 638 | /** |
||
| 639 | * @param string $type |
||
| 640 | * @return array |
||
| 641 | */ |
||
| 642 | public static function getForms($type) { |
||
| 659 | |||
| 660 | /** |
||
| 661 | * register an admin form to be shown |
||
| 662 | * |
||
| 663 | * @param string $app |
||
| 664 | * @param string $page |
||
| 665 | */ |
||
| 666 | public static function registerAdmin($app, $page) { |
||
| 669 | |||
| 670 | /** |
||
| 671 | * register a personal form to be shown |
||
| 672 | * @param string $app |
||
| 673 | * @param string $page |
||
| 674 | */ |
||
| 675 | public static function registerPersonal($app, $page) { |
||
| 678 | |||
| 679 | /** |
||
| 680 | * @param array $entry |
||
| 681 | */ |
||
| 682 | public static function registerLogIn(array $entry) { |
||
| 685 | |||
| 686 | /** |
||
| 687 | * @return array |
||
| 688 | */ |
||
| 689 | public static function getAlternativeLogIns() { |
||
| 692 | |||
| 693 | /** |
||
| 694 | * get a list of all apps in the apps folder |
||
| 695 | * |
||
| 696 | * @return array an array of app names (string IDs) |
||
| 697 | * @todo: change the name of this method to getInstalledApps, which is more accurate |
||
| 698 | */ |
||
| 699 | public static function getAllApps() { |
||
| 725 | |||
| 726 | /** |
||
| 727 | * List all apps, this is used in apps.php |
||
| 728 | * |
||
| 729 | * @return array |
||
| 730 | */ |
||
| 731 | public function listAllApps() { |
||
| 811 | |||
| 812 | public static function shouldUpgrade($app) { |
||
| 823 | |||
| 824 | /** |
||
| 825 | * Adjust the number of version parts of $version1 to match |
||
| 826 | * the number of version parts of $version2. |
||
| 827 | * |
||
| 828 | * @param string $version1 version to adjust |
||
| 829 | * @param string $version2 version to take the number of parts from |
||
| 830 | * @return string shortened $version1 |
||
| 831 | */ |
||
| 832 | private static function adjustVersionParts($version1, $version2) { |
||
| 845 | |||
| 846 | /** |
||
| 847 | * Check whether the current ownCloud version matches the given |
||
| 848 | * application's version requirements. |
||
| 849 | * |
||
| 850 | * The comparison is made based on the number of parts that the |
||
| 851 | * app info version has. For example for ownCloud 6.0.3 if the |
||
| 852 | * app info version is expecting version 6.0, the comparison is |
||
| 853 | * made on the first two parts of the ownCloud version. |
||
| 854 | * This means that it's possible to specify "requiremin" => 6 |
||
| 855 | * and "requiremax" => 6 and it will still match ownCloud 6.0.3. |
||
| 856 | * |
||
| 857 | * @param string $ocVersion ownCloud version to check against |
||
| 858 | * @param array $appInfo app info (from xml) |
||
| 859 | * |
||
| 860 | * @return boolean true if compatible, otherwise false |
||
| 861 | */ |
||
| 862 | public static function isAppCompatible($ocVersion, $appInfo) { |
||
| 902 | |||
| 903 | /** |
||
| 904 | * get the installed version of all apps |
||
| 905 | */ |
||
| 906 | public static function getAppVersions() { |
||
| 915 | |||
| 916 | /** |
||
| 917 | * update the database for the app and call the update script |
||
| 918 | * |
||
| 919 | * @param string $appId |
||
| 920 | * @return bool |
||
| 921 | */ |
||
| 922 | public static function updateApp($appId) { |
||
| 975 | |||
| 976 | /** |
||
| 977 | * @param string $appId |
||
| 978 | * @param string[] $steps |
||
| 979 | * @throws \OC\NeedsUpdateException |
||
| 980 | */ |
||
| 981 | public static function executeRepairSteps($appId, array $steps) { |
||
| 1003 | |||
| 1004 | public static function setupBackgroundJobs(array $jobs) { |
||
| 1010 | |||
| 1011 | /** |
||
| 1012 | * @param string $appId |
||
| 1013 | * @param string[] $steps |
||
| 1014 | */ |
||
| 1015 | private static function setupLiveMigrations($appId, array $steps) { |
||
| 1023 | |||
| 1024 | /** |
||
| 1025 | * @param string $appId |
||
| 1026 | * @return \OC\Files\View|false |
||
| 1027 | */ |
||
| 1028 | public static function getStorage($appId) { |
||
| 1045 | |||
| 1046 | protected static function findBestL10NOption($options, $lang) { |
||
| 1090 | |||
| 1091 | /** |
||
| 1092 | * parses the app data array and enhanced the 'description' value |
||
| 1093 | * |
||
| 1094 | * @param array $data the app data |
||
| 1095 | * @param string $lang |
||
| 1096 | * @return array improved app data |
||
| 1097 | */ |
||
| 1098 | public static function parseAppInfo(array $data, $lang = null) { |
||
| 1116 | |||
| 1117 | /** |
||
| 1118 | * @param \OCP\IConfig $config |
||
| 1119 | * @param \OCP\IL10N $l |
||
| 1120 | * @param array $info |
||
| 1121 | * @throws \Exception |
||
| 1122 | */ |
||
| 1123 | public static function checkAppDependencies($config, $l, $info) { |
||
| 1135 | } |
||
| 1136 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.