cleanup variable naming, it is actually a resource type

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-06-13 14:34:03 +02:00
parent 5c8b26248b
commit e251b34a8c
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
2 changed files with 17 additions and 19 deletions

View File

@ -82,15 +82,13 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
/** /**
* Registers an callback function which must return an cloud federation provider * Registers an callback function which must return an cloud federation provider
* *
* @param string $shareType which share type does the provider handles * @param string $resourceType which resource type does the provider handles
* @param string $displayName user facing name of the federated share provider * @param string $displayName user facing name of the federated share provider
* @param callable $callback * @param callable $callback
*/ */
public function addCloudFederationProvider($shareType, $displayName, callable $callback) { public function addCloudFederationProvider($resourceType, $displayName, callable $callback) {
\OC::$server->getRemoteApiFactory(); $this->cloudFederationProvider[$resourceType] = [
'resourceType' => $resourceType,
$this->cloudFederationProvider[$shareType] = [
'shareType' => $shareType,
'displayName' => $displayName, 'displayName' => $displayName,
'callback' => $callback, 'callback' => $callback,
]; ];
@ -109,7 +107,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
/** /**
* get a list of all cloudFederationProviders * get a list of all cloudFederationProviders
* *
* @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]] * @return array [resourceType => ['resourceType' => $resourceType, 'displayName' => $displayName, 'callback' => callback]]
*/ */
public function getAllCloudFederationProviders() { public function getAllCloudFederationProviders() {
return $this->cloudFederationProvider; return $this->cloudFederationProvider;
@ -118,15 +116,15 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
/** /**
* get a specific cloud federation provider * get a specific cloud federation provider
* *
* @param string $shareType * @param string $resourceType
* @return ICloudFederationProvider * @return ICloudFederationProvider
* @throws ProviderDoesNotExistsException * @throws ProviderDoesNotExistsException
*/ */
public function getCloudFederationProvider($shareType) { public function getCloudFederationProvider($resourceType) {
if (isset($this->cloudFederationProvider[$shareType])) { if (isset($this->cloudFederationProvider[$resourceType])) {
return call_user_func($this->cloudFederationProvider[$shareType]['callback']); return call_user_func($this->cloudFederationProvider[$resourceType]['callback']);
} else { } else {
throw new ProviderDoesNotExistsException($shareType); throw new ProviderDoesNotExistsException($resourceType);
} }
} }

View File

@ -35,28 +35,28 @@ interface ICloudFederationProviderManager {
/** /**
* Registers an callback function which must return an cloud federation provider * Registers an callback function which must return an cloud federation provider
* *
* @param string $shareType which share type does the provider handles * @param string $resourceType which resource type does the provider handles
* @param string $displayName user facing name of the federated share provider * @param string $displayName user facing name of the federated share provider
* @param callable $callback * @param callable $callback
* @throws Exceptions\ProviderAlreadyExistsException * @throws Exceptions\ProviderAlreadyExistsException
* *
* @since 14.0.0 * @since 14.0.0
*/ */
public function addCloudFederationProvider($shareType, $displayName, callable $callback); public function addCloudFederationProvider($resourceType, $displayName, callable $callback);
/** /**
* remove cloud federation provider * remove cloud federation provider
* *
* @param string $shareType * @param string $resourceType
* *
* @since 14.0.0 * @since 14.0.0
*/ */
public function removeCloudFederationProvider($shareType); public function removeCloudFederationProvider($resourceType);
/** /**
* get a list of all cloudFederationProviders * get a list of all cloudFederationProviders
* *
* @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]] * @return array [resourceType => ['resourceType' => $resourceType, 'displayName' => $displayName, 'callback' => callback]]
* *
* @since 14.0.0 * @since 14.0.0
*/ */
@ -65,13 +65,13 @@ interface ICloudFederationProviderManager {
/** /**
* get a specific cloud federation provider * get a specific cloud federation provider
* *
* @param string $shareType * @param string $resourceType
* @return ICloudFederationProvider * @return ICloudFederationProvider
* @throws Exceptions\ProviderDoesNotExistsException; * @throws Exceptions\ProviderDoesNotExistsException;
* *
* @since 14.0.0 * @since 14.0.0
*/ */
public function getCloudFederationProvider($shareType); public function getCloudFederationProvider($resourceType);
/** /**
* send federated share * send federated share