Skip to content

Commit

Permalink
Merge pull request #39057 from nextcloud/feat/ocp/type-icapabilities
Browse files Browse the repository at this point in the history
feat(ocp): More specific type for ICapabilities::getCapabilities
  • Loading branch information
ChristophWurst authored Jul 3, 2023
2 parents 1d5beb3 + 1949996 commit 67709b3
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 29 deletions.
3 changes: 0 additions & 3 deletions apps/cloud_federation_api/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public function __construct(IURLGenerator $urlGenerator) {

/**
* Function an app uses to return the capabilities
*
* @return array Array containing the apps capabilities
* @since 8.2.0
*/
public function getCapabilities() {
$url = $this->urlGenerator->linkToRouteAbsolute('cloud_federation_api.requesthandlercontroller.addShare');
Expand Down
2 changes: 0 additions & 2 deletions apps/files/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public function __construct(IConfig $config) {

/**
* Return this classes capabilities
*
* @return array
*/
public function getCapabilities() {
return [
Expand Down
2 changes: 0 additions & 2 deletions apps/files_sharing/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public function __construct(IConfig $config, IManager $shareManager) {

/**
* Return this classes capabilities
*
* @return array
*/
public function getCapabilities() {
$res = [];
Expand Down
2 changes: 0 additions & 2 deletions apps/files_trashbin/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class Capabilities implements ICapability {

/**
* Return this classes capabilities
*
* @return array
*/
public function getCapabilities() {
return [
Expand Down
2 changes: 0 additions & 2 deletions apps/files_versions/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public function __construct(

/**
* Return this classes capabilities
*
* @return array
*/
public function getCapabilities() {
$groupFolderInstalled = $this->appManager->isInstalled('groupfolders');
Expand Down
2 changes: 0 additions & 2 deletions apps/provisioning_api/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public function __construct(IAppManager $appManager) {

/**
* Function an app uses to return the capabilities
*
* @return array Array containing the apps capabilities
*/
public function getCapabilities() {
$federatedScopeEnabled = $this->appManager->isEnabledForUser('federation');
Expand Down
2 changes: 0 additions & 2 deletions apps/theming/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public function __construct(ThemingDefaults $theming, Util $util, IURLGenerator

/**
* Return this classes capabilities
*
* @return array
*/
public function getCapabilities() {
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', '');
Expand Down
3 changes: 0 additions & 3 deletions apps/user_status/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public function __construct(IEmojiHelper $emojiHelper) {
$this->emojiHelper = $emojiHelper;
}

/**
* @inheritDoc
*/
public function getCapabilities() {
return [
'user_status' => [
Expand Down
3 changes: 0 additions & 3 deletions apps/weather_status/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class Capabilities implements ICapability {
public function __construct() {
}

/**
* @inheritDoc
*/
public function getCapabilities() {
return [
Application::APP_ID => [
Expand Down
2 changes: 0 additions & 2 deletions lib/private/OCS/CoreCapabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public function __construct(IConfig $config) {

/**
* Return this classes capabilities
*
* @return array
*/
public function getCapabilities() {
return [
Expand Down
21 changes: 15 additions & 6 deletions lib/public/Capabilities/ICapability.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,28 @@
* Minimal interface that has to be implemented for a class to be considered
* a capability.
*
* In an application use:
* $this->getContainer()->registerCapability('OCA\MY_APP\Capabilities');
* To register capabilities.
*
* The class 'OCA\MY_APP\Capabilities' must then implement ICapability
* In an application use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCapability
* to register capabilities.
*
* @since 8.2.0
*/
interface ICapability {
/**
* Function an app uses to return the capabilities
*
* @return array Array containing the apps capabilities
* ```php
* return [
* 'myapp' => [
* 'awesomefeature' => true,
* 'featureversion' => 3,
* ],
* 'morecomplex' => [
* 'a' => [1, 2],
* ],
* ];
* ```
*
* @return array<string, array<string, mixed>> Indexed array containing the app's capabilities
* @since 8.2.0
*/
public function getCapabilities();
Expand Down

0 comments on commit 67709b3

Please sign in to comment.