for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
/**
* ownCloud - Music app
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
* @author Pauli Järvinen <[email protected]>
* @copyright Pauli Järvinen 2022 - 2025
*/
namespace OCA\Music\Utility;
class AppInfo {
public const APP_ID = 'music';
public static function getVersion() : string {
// Nextcloud 14 introduced a new API for this which is not available on ownCloud.
// Nextcloud 25 removed the old API for good.
$appManager = \OC::$server->getAppManager();
if (\method_exists($appManager, 'getAppVersion')) {
return $appManager->getAppVersion(self::APP_ID); // NC14+
} else {
return \OCP\App::getAppVersion(self::APP_ID); // OC or NC13
OCP\App::getAppVersion()
If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated annotation
ignore-deprecated
return /** @scrutinizer ignore-deprecated */ \OCP\App::getAppVersion(self::APP_ID); // OC or NC13
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
}
public static function getVendor() : string {
$vendor = 'owncloud/nextcloud'; // this should get overridden by the next 'include'
include \OC::$SERVERROOT . '/version.php';
return $vendor;
public static function getFullName() : string {
return self::getVendor() . ' ' . self::APP_ID;
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.