diff options
243 files changed, 0 insertions, 11031 deletions
diff --git a/core/Notification/CoreNotifier.php b/core/Notification/CoreNotifier.php index 83a86513e03..743bc42bf95 100644 --- a/core/Notification/CoreNotifier.php +++ b/core/Notification/CoreNotifier.php @@ -24,22 +24,10 @@ class CoreNotifier implements INotifier { ) { } - /** - * Identifier of the notifier, only use [a-z0-9_] - * - * @return string - * @since 17.0.0 - */ public function getID(): string { return 'core'; } - /** - * Human readable name describing the notifier - * - * @return string - * @since 17.0.0 - */ public function getName(): string { return $this->factory->get('core')->t('Nextcloud Server'); } diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php index 946168d7755..d7bcbd9e05d 100644 --- a/lib/private/Accounts/Account.php +++ b/lib/private/Accounts/Account.php @@ -105,7 +105,6 @@ class Account implements IAccount { return $result; } - /** @return array<string, IAccountProperty|array<int, IAccountProperty>> */ public function jsonSerialize(): array { $properties = $this->properties; foreach ($properties as $propertyName => $propertyObject) { diff --git a/lib/private/Accounts/AccountProperty.php b/lib/private/Accounts/AccountProperty.php index 0c4ad568709..2caa99c1100 100644 --- a/lib/private/Accounts/AccountProperty.php +++ b/lib/private/Accounts/AccountProperty.php @@ -39,21 +39,11 @@ class AccountProperty implements IAccountProperty { ]; } - /** - * Set the value of a property - * - * @since 15.0.0 - */ public function setValue(string $value): IAccountProperty { $this->value = $value; return $this; } - /** - * Set the scope of a property - * - * @since 15.0.0 - */ public function setScope(string $scope): IAccountProperty { $newScope = $this->mapScopeToV2($scope); if (!in_array($newScope, [ @@ -68,39 +58,19 @@ class AccountProperty implements IAccountProperty { return $this; } - /** - * Set the verification status of a property - * - * @since 15.0.0 - */ public function setVerified(string $verified): IAccountProperty { $this->verified = $verified; return $this; } - /** - * Get the name of a property - * - * @since 15.0.0 - */ public function getName(): string { return $this->name; } - /** - * Get the value of a property - * - * @since 15.0.0 - */ public function getValue(): string { return $this->value; } - /** - * Get the scope of a property - * - * @since 15.0.0 - */ public function getScope(): string { return $this->scope; } @@ -118,11 +88,6 @@ class AccountProperty implements IAccountProperty { }; } - /** - * Get the verification status of a property - * - * @since 15.0.0 - */ public function getVerified(): string { return $this->verified; } diff --git a/lib/private/Activity/Event.php b/lib/private/Activity/Event.php index 97ab7d1c935..7fe69d7aca8 100644 --- a/lib/private/Activity/Event.php +++ b/lib/private/Activity/Event.php @@ -70,9 +70,6 @@ class Event implements IEvent { $this->richValidator = $richValidator; } - /** - * {@inheritDoc} - */ public function setApp(string $app): IEvent { if ($app === '' || isset($app[32])) { throw new InvalidValueException('app'); @@ -81,16 +78,10 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getApp(): string { return $this->app; } - /** - * {@inheritDoc} - */ public function setType(string $type): IEvent { if ($type === '' || isset($type[255])) { throw new InvalidValueException('type'); @@ -99,16 +90,10 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getType(): string { return $this->type; } - /** - * {@inheritDoc} - */ public function setAffectedUser(string $affectedUser): IEvent { if ($affectedUser === '' || isset($affectedUser[64])) { throw new InvalidValueException('affectedUser'); @@ -117,16 +102,10 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getAffectedUser(): string { return $this->affectedUser; } - /** - * {@inheritDoc} - */ public function setAuthor(string $author): IEvent { if (isset($author[64])) { throw new InvalidValueException('author'); @@ -135,16 +114,10 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getAuthor(): string { return $this->author; } - /** - * {@inheritDoc} - */ public function setTimestamp(int $timestamp): IEvent { if ($timestamp < 0) { throw new InvalidValueException('timestamp'); @@ -153,16 +126,10 @@ class Event implements IEvent { return $this; } - /** - * @return int - */ public function getTimestamp(): int { return $this->timestamp; } - /** - * {@inheritDoc} - */ public function setSubject(string $subject, array $parameters = []): IEvent { if (isset($subject[255])) { throw new InvalidValueException('subject'); @@ -172,23 +139,14 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getSubject(): string { return $this->subject; } - /** - * @return array - */ public function getSubjectParameters(): array { return $this->subjectParameters; } - /** - * {@inheritDoc} - */ public function setParsedSubject(string $subject): IEvent { if ($subject === '') { throw new InvalidValueException('parsedSubject'); @@ -197,17 +155,10 @@ class Event implements IEvent { return $this; } - /** - * @return string - * @since 11.0.0 - */ public function getParsedSubject(): string { return $this->subjectParsed; } - /** - * {@inheritDoc} - */ public function setRichSubject(string $subject, array $parameters = []): IEvent { if ($subject === '') { throw new InvalidValueException('richSubject'); @@ -250,25 +201,14 @@ class Event implements IEvent { return str_replace($placeholders, $replacements, $message); } - /** - * @return string - * @since 11.0.0 - */ public function getRichSubject(): string { return $this->subjectRich; } - /** - * @return array[] - * @since 11.0.0 - */ public function getRichSubjectParameters(): array { return $this->subjectRichParameters; } - /** - * {@inheritDoc} - */ public function setMessage(string $message, array $parameters = []): IEvent { if (isset($message[255])) { throw new InvalidValueException('message'); @@ -278,39 +218,23 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getMessage(): string { return $this->message; } - /** - * @return array - */ public function getMessageParameters(): array { return $this->messageParameters; } - /** - * {@inheritDoc} - */ public function setParsedMessage(string $message): IEvent { $this->messageParsed = $message; return $this; } - /** - * @return string - * @since 11.0.0 - */ public function getParsedMessage(): string { return $this->messageParsed; } - /** - * {@inheritDoc} - */ public function setRichMessage(string $message, array $parameters = []): IEvent { $this->messageRich = $message; $this->messageRichParameters = $parameters; @@ -326,25 +250,14 @@ class Event implements IEvent { return $this; } - /** - * @return string - * @since 11.0.0 - */ public function getRichMessage(): string { return $this->messageRich; } - /** - * @return array[] - * @since 11.0.0 - */ public function getRichMessageParameters(): array { return $this->messageRichParameters; } - /** - * {@inheritDoc} - */ public function setObject(string $objectType, int $objectId, string $objectName = ''): IEvent { if (isset($objectType[255])) { throw new InvalidValueException('objectType'); @@ -358,30 +271,18 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getObjectType(): string { return $this->objectType; } - /** - * @return int - */ public function getObjectId(): int { return $this->objectId; } - /** - * @return string - */ public function getObjectName(): string { return $this->objectName; } - /** - * {@inheritDoc} - */ public function setLink(string $link): IEvent { if (isset($link[4000])) { throw new InvalidValueException('link'); @@ -390,16 +291,10 @@ class Event implements IEvent { return $this; } - /** - * @return string - */ public function getLink(): string { return $this->link; } - /** - * {@inheritDoc} - */ public function setIcon(string $icon): IEvent { if (isset($icon[4000])) { throw new InvalidValueException('icon'); @@ -408,36 +303,19 @@ class Event implements IEvent { return $this; } - /** - * @return string - * @since 11.0.0 - */ public function getIcon(): string { return $this->icon; } - /** - * @param IEvent $child - * @return $this - * @since 11.0.0 - Since 15.0.0 returns $this - */ public function setChildEvent(IEvent $child): IEvent { $this->child = $child; return $this; } - /** - * @return IEvent|null - * @since 11.0.0 - */ public function getChildEvent() { return $this->child; } - /** - * @return bool - * @since 8.2.0 - */ public function isValid(): bool { return $this->isValidCommon() @@ -446,10 +324,6 @@ class Event implements IEvent { ; } - /** - * @return bool - * @since 8.2.0 - */ public function isValidParsed(): bool { if ($this->getRichSubject() !== '' || !empty($this->getRichSubjectParameters())) { try { diff --git a/lib/private/Activity/EventMerger.php b/lib/private/Activity/EventMerger.php index 504f9088f24..aa7e7c61c77 100644 --- a/lib/private/Activity/EventMerger.php +++ b/lib/private/Activity/EventMerger.php @@ -20,34 +20,6 @@ class EventMerger implements IEventMerger { $this->l10n = $l10n; } - /** - * Combines two events when possible to have grouping: - * - * Example1: Two events with subject '{user} created {file}' and - * $mergeParameter file with different file and same user will be merged - * to '{user} created {file1} and {file2}' and the childEvent on the return - * will be set, if the events have been merged. - * - * Example2: Two events with subject '{user} created {file}' and - * $mergeParameter file with same file and same user will be merged to - * '{user} created {file1}' and the childEvent on the return will be set, if - * the events have been merged. - * - * The following requirements have to be met, in order to be merged: - * - Both events need to have the same `getApp()` - * - Both events must not have a message `getMessage()` - * - Both events need to have the same subject `getSubject()` - * - Both events need to have the same object type `getObjectType()` - * - The time difference between both events must not be bigger then 3 hours - * - Only up to 5 events can be merged. - * - All parameters apart from such starting with $mergeParameter must be - * the same for both events. - * - * @param string $mergeParameter - * @param IEvent $event - * @param IEvent|null $previousEvent - * @return IEvent - */ public function mergeEvents($mergeParameter, IEvent $event, ?IEvent $previousEvent = null) { // No second event => can not combine if (!$previousEvent instanceof IEvent) { diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php index 54d50a47dcb..992b9bd9435 100644 --- a/lib/private/Activity/Manager.php +++ b/lib/private/Activity/Manager.php @@ -91,25 +91,10 @@ class Manager implements IManager { return $this->consumers; } - /** - * Generates a new IEvent object - * - * Make sure to call at least the following methods before sending it to the - * app with via the publish() method: - * - setApp() - * - setType() - * - setAffectedUser() - * - setSubject() - * - * @return IEvent - */ public function generateEvent(): IEvent { return new Event($this->validator); } - /** - * {@inheritDoc} - */ public function publish(IEvent $event): void { if ($event->getAuthor() === '') { if ($this->session->getUser() instanceof IUser) { @@ -130,14 +115,6 @@ class Manager implements IManager { } } - /** - * In order to improve lazy loading a closure can be registered which will be called in case - * activity consumers are actually requested - * - * $callable has to return an instance of OCA\Activity\IConsumer - * - * @param \Closure $callable - */ public function registerConsumer(\Closure $callable): void { $this->consumersClosures[] = $callable; $this->consumers = []; @@ -149,18 +126,10 @@ class Manager implements IManager { /** @var IFilter[] */ protected $filters = []; - /** - * @param string $filter Class must implement OCA\Activity\IFilter - * @return void - */ public function registerFilter(string $filter): void { $this->filterClasses[$filter] = false; } - /** - * @return IFilter[] - * @throws \InvalidArgumentException - */ public function getFilters(): array { foreach ($this->filterClasses as $class => $false) { /** @var IFilter $filter */ @@ -177,9 +146,6 @@ class Manager implements IManager { return $this->filters; } - /** - * {@inheritDoc} - */ public function getFilterById(string $id): IFilter { $filters = $this->getFilters(); @@ -196,18 +162,10 @@ class Manager implements IManager { /** @var IProvider[] */ protected $providers = []; - /** - * @param string $provider Class must implement OCA\Activity\IProvider - * @return void - */ public function registerProvider(string $provider): void { $this->providerClasses[$provider] = false; } - /** - * @return IProvider[] - * @throws \InvalidArgumentException - */ public function getProviders(): array { foreach ($this->providerClasses as $class => $false) { /** @var IProvider $provider */ @@ -230,18 +188,10 @@ class Manager implements IManager { /** @var ISetting[] */ protected $settings = []; - /** - * @param string $setting Class must implement OCA\Activity\ISetting - * @return void - */ public function registerSetting(string $setting): void { $this->settingsClasses[$setting] = false; } - /** - * @return ActivitySettings[] - * @throws \InvalidArgumentException - */ public function getSettings(): array { foreach ($this->settingsClasses as $class => $false) { /** @var ISetting $setting */ @@ -262,9 +212,6 @@ class Manager implements IManager { return $this->settings; } - /** - * {@inheritDoc} - */ public function getSettingById(string $id): ActivitySettings { $settings = $this->getSettings(); @@ -276,55 +223,29 @@ class Manager implements IManager { } - /** - * @param string $type - * @param int $id - */ public function setFormattingObject(string $type, int $id): void { $this->formattingObjectType = $type; $this->formattingObjectId = $id; } - /** - * @return bool - */ public function isFormattingFilteredObject(): bool { return $this->formattingObjectType !== null && $this->formattingObjectId !== null && $this->formattingObjectType === $this->request->getParam('object_type') && $this->formattingObjectId === (int)$this->request->getParam('object_id'); } - /** - * @param bool $status Set to true, when parsing events should not use SVG icons - */ public function setRequirePNG(bool $status): void { $this->requirePNG = $status; } - /** - * @return bool - */ public function getRequirePNG(): bool { return $this->requirePNG; } - /** - * Set the user we need to use - * - * @param string|null $currentUserId - */ public function setCurrentUserId(?string $currentUserId = null): void { $this->currentUserId = $currentUserId; } - /** - * Get the user we need to use - * - * Either the user is logged in, or we try to get it from the token - * - * @return string - * @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique - */ public function getCurrentUserId(): string { if ($this->currentUserId !== null) { return $this->currentUserId; diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index 263b5283133..a1fe794ee08 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -65,168 +65,59 @@ class AllConfig implements IConfig { } } - /** - * Sets and deletes system wide values - * - * @param array $configs Associative array with `key => value` pairs - * If value is null, the config key will be deleted - */ public function setSystemValues(array $configs) { $this->systemConfig->setValues($configs); } - /** - * Sets a new system wide value - * - * @param string $key the key of the value, under which will be saved - * @param mixed $value the value that should be stored - */ public function setSystemValue($key, $value) { $this->systemConfig->setValue($key, $value); } - /** - * Looks up a system wide defined value - * - * @param string $key the key of the value, under which it was saved - * @param mixed $default the default value to be returned if the value isn't set - * @return mixed the value or $default - */ public function getSystemValue($key, $default = '') { return $this->systemConfig->getValue($key, $default); } - /** - * Looks up a boolean system wide defined value - * - * @param string $key the key of the value, under which it was saved - * @param bool $default the default value to be returned if the value isn't set - * - * @return bool - * - * @since 16.0.0 - */ public function getSystemValueBool(string $key, bool $default = false): bool { return (bool)$this->getSystemValue($key, $default); } - /** - * Looks up an integer system wide defined value - * - * @param string $key the key of the value, under which it was saved - * @param int $default the default value to be returned if the value isn't set - * - * @return int - * - * @since 16.0.0 - */ public function getSystemValueInt(string $key, int $default = 0): int { return (int)$this->getSystemValue($key, $default); } - /** - * Looks up a string system wide defined value - * - * @param string $key the key of the value, under which it was saved - * @param string $default the default value to be returned if the value isn't set - * - * @return string - * - * @since 16.0.0 - */ public function getSystemValueString(string $key, string $default = ''): string { return (string)$this->getSystemValue($key, $default); } - /** - * Looks up a system wide defined value and filters out sensitive data - * - * @param string $key the key of the value, under which it was saved - * @param mixed $default the default value to be returned if the value isn't set - * @return mixed the value or $default - */ public function getFilteredSystemValue($key, $default = '') { return $this->systemConfig->getFilteredValue($key, $default); } - /** - * Delete a system wide defined value - * - * @param string $key the key of the value, under which it was saved - */ public function deleteSystemValue($key) { $this->systemConfig->deleteValue($key); } - /** - * Get all keys stored for an app - * - * @param string $appName the appName that we stored the value under - * @return string[] the keys stored for the app - * @deprecated 29.0.0 Use {@see IAppConfig} directly - */ public function getAppKeys($appName) { return \OC::$server->get(AppConfig::class)->getKeys($appName); } - /** - * Writes a new app wide value - * - * @param string $appName the appName that we want to store the value under - * @param string $key the key of the value, under which will be saved - * @param string|float|int $value the value that should be stored - * @deprecated 29.0.0 Use {@see IAppConfig} directly - */ public function setAppValue($appName, $key, $value) { \OC::$server->get(AppConfig::class)->setValue($appName, $key, $value); } - /** - * Looks up an app wide defined value - * - * @param string $appName the appName that we stored the value under - * @param string $key the key of the value, under which it was saved - * @param string $default the default value to be returned if the value isn't set - * @return string the saved value - * @deprecated 29.0.0 Use {@see IAppConfig} directly - */ public function getAppValue($appName, $key, $default = '') { return \OC::$server->get(AppConfig::class)->getValue($appName, $key, $default); } - /** - * Delete an app wide defined value - * - * @param string $appName the appName that we stored the value under - * @param string $key the key of the value, under which it was saved - * @deprecated 29.0.0 Use {@see IAppConfig} directly - */ public function deleteAppValue($appName, $key) { \OC::$server->get(AppConfig::class)->deleteKey($appName, $key); } - /** - * Removes all keys in appconfig belonging to the app - * - * @param string $appName the appName the configs are stored under - * @deprecated 29.0.0 Use {@see IAppConfig} directly - */ public function deleteAppValues($appName) { \OC::$server->get(AppConfig::class)->deleteApp($appName); } - /** - * Set a user defined value - * - * @param string $userId the userId of the user that we want to store the value under - * @param string $appName the appName that we want to store the value under - * @param string $key the key under which the value is being stored - * @param string|float|int $value the value that you want to store - * @param string $preCondition only update if the config value was previously the value passed as $preCondition - * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met - * @throws \UnexpectedValueException when trying to store an unexpected value - */ public function setUserValue($userId, $appName, $key, $value, $preCondition = null) { if (!is_int($value) && !is_float($value) && !is_string($value)) { throw new \UnexpectedValueException('Only integers, floats and strings are allowed as value'); @@ -284,15 +175,6 @@ class AllConfig implements IConfig { } } - /** - * Getting a user defined value - * - * @param ?string $userId the userId of the user that we want to store the value under - * @param string $appName the appName that we stored the value under - * @param string $key the key under which the value is being stored - * @param mixed $default the default value to be returned if the value isn't set - * @return string - */ public function getUserValue($userId, $appName, $key, $default = '') { $data = $this->getAllUserValues($userId); if (isset($data[$appName][$key])) { @@ -302,13 +184,6 @@ class AllConfig implements IConfig { } } - /** - * Get the keys of all stored by an app for the user - * - * @param string $userId the userId of the user that we want to store the value under - * @param string $appName the appName that we stored the value under - * @return string[] - */ public function getUserKeys($userId, $appName) { $data = $this->getAllUserValues($userId); if (isset($data[$appName])) { @@ -318,13 +193,6 @@ class AllConfig implements IConfig { } } - /** - * Delete a user value - * - * @param string $userId the userId of the user that we want to store the value under - * @param string $appName the appName that we stored the value under - * @param string $key the key under which the value is being stored - */ public function deleteUserValue($userId, $appName, $key) { // TODO - FIXME $this->fixDIInit(); @@ -341,11 +209,6 @@ class AllConfig implements IConfig { } } - /** - * Delete all user values - * - * @param string $userId the userId of the user that we want to remove all values from - */ public function deleteAllUserValues($userId) { // TODO - FIXME $this->fixDIInit(); @@ -357,11 +220,6 @@ class AllConfig implements IConfig { unset($this->userCache[$userId]); } - /** - * Delete all user related values of one app - * - * @param string $appName the appName of the app that we want to remove all values from - */ public function deleteAppFromAllUsers($appName) { // TODO - FIXME $this->fixDIInit(); @@ -376,16 +234,6 @@ class AllConfig implements IConfig { } } - /** - * Returns all user configs sorted by app of one user - * - * @param ?string $userId the user ID to get the app configs from - * @psalm-return array<string, array<string, string>> - * @return array[] - 2 dimensional array with the following structure: - * [ $appId => - * [ $key => $value ] - * ] - */ public function getAllUserValues(?string $userId): array { if (isset($this->userCache[$userId])) { return $this->userCache[$userId]; @@ -416,14 +264,6 @@ class AllConfig implements IConfig { return $data; } - /** - * Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs. - * - * @param string $appName app to get the value for - * @param string $key the key to get the value for - * @param array $userIds the user IDs to fetch the values for - * @return array Mapped values: userId => value - */ public function getUserValueForUsers($appName, $key, $userIds) { // TODO - FIXME $this->fixDIInit(); @@ -456,14 +296,6 @@ class AllConfig implements IConfig { return $userValues; } - /** - * Determines the users that have the given value set for a specific app-key-pair - * - * @param string $appName the app to get the user for - * @param string $key the key to get the user for - * @param string $value the value to get the user for - * @return list<string> of user IDs - */ public function getUsersForUserValue($appName, $key, $value) { // TODO - FIXME $this->fixDIInit(); diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 2f129ca77fa..b1dae8ab108 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -138,21 +138,10 @@ class AppManager implements IAppManager { return $this->installedAppsCache; } - /** - * List all installed apps - * - * @return string[] - */ public function getInstalledApps() { return array_keys($this->getInstalledAppsValues()); } - /** - * List all apps enabled for a user - * - * @param \OCP\IUser $user - * @return string[] - */ public function getEnabledAppsForUser(IUser $user) { $apps = $this->getInstalledAppsValues(); $appsForUser = array_filter($apps, function ($enabled) use ($user) { @@ -161,10 +150,6 @@ class AppManager implements IAppManager { return array_keys($appsForUser); } - /** - * @param IGroup $group - * @return array - */ public function getEnabledAppsForGroup(IGroup $group): array { $apps = $this->getInstalledAppsValues(); $appsForGroups = array_filter($apps, function ($enabled) use ($group) { @@ -173,18 +158,6 @@ class AppManager implements IAppManager { return array_keys($appsForGroups); } - /** - * Loads all apps - * - * @param string[] $types - * @return bool - * - * This function walks through the Nextcloud directory and loads all apps - * it can find. A directory contains an app if the file /appinfo/info.xml - * exists. - * - * if $types is set to non-empty array, only apps of those types will be loaded - */ public function loadApps(array $types = []): bool { if ($this->config->getSystemValueBool('maintenance', false)) { return false; @@ -222,13 +195,6 @@ class AppManager implements IAppManager { return true; } - /** - * check if an app is of a specific type - * - * @param string $app - * @param array $types - * @return bool - */ public function isType(string $app, array $types): bool { $appTypes = $this->getAppTypes($app); foreach ($types as $type) { @@ -265,10 +231,6 @@ class AppManager implements IAppManager { return $this->autoDisabledApps; } - /** - * @param string $appId - * @return array - */ public function getAppRestriction(string $appId): array { $values = $this->getInstalledAppsValues(); @@ -283,13 +245,6 @@ class AppManager implements IAppManager { } - /** - * Check if an app is enabled for user - * - * @param string $appId - * @param \OCP\IUser|null $user (optional) if not defined, the currently logged in user will be used - * @return bool - */ public function isEnabledForUser($appId, $user = null) { if ($this->isAlwaysEnabled($appId)) { return true; @@ -357,15 +312,6 @@ class AppManager implements IAppManager { } } - /** - * Check if an app is enabled in the instance - * - * Notice: This actually checks if the app is enabled and not only if it is installed. - * - * @param string $appId - * @param IGroup[]|String[] $groups - * @return bool - */ public function isInstalled($appId) { $installedApps = $this->getInstalledAppsValues(); return isset($installedApps[$appId]); @@ -502,11 +448,6 @@ class AppManager implements IAppManager { $eventLogger->end("bootstrap:load_app:$app"); } - /** - * Check if an app is loaded - * @param string $app app id - * @since 26.0.0 - */ public function isAppLoaded(string $app): bool { return isset($this->loadedApps[$app]); } @@ -522,13 +463,6 @@ class AppManager implements IAppManager { require_once $app . '/appinfo/app.php'; } - /** - * Enable an app for every user - * - * @param string $appId - * @param bool $forceEnable - * @throws AppPathNotFoundException - */ public function enableApp(string $appId, bool $forceEnable = false): void { // Check if app exists $this->getAppPath($appId); @@ -546,12 +480,6 @@ class AppManager implements IAppManager { $this->clearAppsCache(); } - /** - * Whether a list of types contains a protected app type - * - * @param string[] $types - * @return bool - */ public function hasProtectedAppType($types) { if (empty($types)) { return false; @@ -561,15 +489,6 @@ class AppManager implements IAppManager { return !empty($protectedTypes); } - /** - * Enable an app only for specific groups - * - * @param string $appId - * @param IGroup[] $groups - * @param bool $forceEnable - * @throws \InvalidArgumentException if app can't be enabled for groups - * @throws AppPathNotFoundException - */ public function enableAppForGroups(string $appId, array $groups, bool $forceEnable = false): void { // Check if app exists $this->getAppPath($appId); @@ -600,13 +519,6 @@ class AppManager implements IAppManager { $this->clearAppsCache(); } - /** - * Disable an app for every user - * - * @param string $appId - * @param bool $automaticDisabled - * @throws \Exception if app can't be disabled - */ public function disableApp($appId, $automaticDisabled = false) { if ($this->isAlwaysEnabled($appId)) { throw new \Exception("$appId can't be disabled."); @@ -636,13 +548,6 @@ class AppManager implements IAppManager { $this->clearAppsCache(); } - /** - * Get the directory for the given app. - * - * @param string $appId - * @return string - * @throws AppPathNotFoundException if app folder can't be found - */ public function getAppPath($appId) { $appPath = \OC_App::getAppPath($appId); if ($appPath === false) { @@ -651,13 +556,6 @@ class AppManager implements IAppManager { return $appPath; } - /** - * Get the web path for the given app. - * - * @param string $appId - * @return string - * @throws AppPathNotFoundException if app path can't be found - */ public function getAppWebPath(string $appId): string { $appWebPath = \OC_App::getAppWebPath($appId); if ($appWebPath === false) { @@ -666,9 +564,6 @@ class AppManager implements IAppManager { return $appWebPath; } - /** - * Clear the cached list of apps when enabling/disabling an app - */ public function clearAppsCache() { $this->appInfos = []; } @@ -699,12 +594,6 @@ class AppManager implements IAppManager { return $appsToUpgrade; } - /** - * Returns the app information from "appinfo/info.xml". - * - * @param string|null $lang - * @return array|null app info - */ public function getAppInfo(string $appId, bool $path = false, $lang = null) { if ($path) { $file = $appId; @@ -765,10 +654,6 @@ class AppManager implements IAppManager { return $incompatibleApps; } - /** - * @inheritdoc - * In case you change this method, also change \OC\App\CodeChecker\InfoChecker::isShipped() - */ public function isShipped($appId) { $this->loadShippedJson(); return in_array($appId, $this->shippedApps, true); @@ -796,24 +681,15 @@ class AppManager implements IAppManager { } } - /** - * @inheritdoc - */ public function getAlwaysEnabledApps() { $this->loadShippedJson(); return $this->alwaysEnabled; } - /** - * @inheritdoc - */ public function isDefaultEnabled(string $appId): bool { return (in_array($appId, $this->getDefaultEnabledApps())); } - /** - * @inheritdoc - */ public function getDefaultEnabledApps(): array { $this->loadShippedJson(); diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index f6361ff2ac6..bd01194863a 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -73,12 +73,6 @@ class AppConfig implements IAppConfig { ) { } - /** - * @inheritDoc - * - * @return string[] list of app ids - * @since 7.0.0 - */ public function getApps(): array { $this->loadConfigAll(); $apps = array_merge(array_keys($this->fastCache), array_keys($this->lazyCache)); @@ -87,14 +81,6 @@ class AppConfig implements IAppConfig { return array_values(array_unique($apps)); } - /** - * @inheritDoc - * - * @param string $app id of the app - * - * @return string[] list of stored config keys - * @since 29.0.0 - */ public function getKeys(string $app): array { $this->assertParams($app); $this->loadConfigAll(); @@ -104,17 +90,6 @@ class AppConfig implements IAppConfig { return array_values(array_unique($keys)); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config - * - * @return bool TRUE if key exists - * @since 7.0.0 - * @since 29.0.0 Added the $lazy argument - */ public function hasKey(string $app, string $key, ?bool $lazy = false): bool { $this->assertParams($app, $key); $this->loadConfig($lazy); @@ -131,15 +106,6 @@ class AppConfig implements IAppConfig { return isset($this->fastCache[$app][$key]); } - /** - * @param string $app id of the app - * @param string $key config key - * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config - * - * @return bool - * @throws AppConfigUnknownKeyException if config key is not known - * @since 29.0.0 - */ public function isSensitive(string $app, string $key, ?bool $lazy = false): bool { $this->assertParams($app, $key); $this->loadConfig($lazy); @@ -151,17 +117,6 @@ class AppConfig implements IAppConfig { return $this->isTyped(self::VALUE_SENSITIVE, $this->valueTypes[$app][$key]); } - /** - * @inheritDoc - * - * @param string $app if of the app - * @param string $key config key - * - * @return bool TRUE if config is lazy loaded - * @throws AppConfigUnknownKeyException if config key is not known - * @see IAppConfig for details about lazy loading - * @since 29.0.0 - */ public function isLazy(string $app, string $key): bool { // there is a huge probability the non-lazy config are already loaded if ($this->hasKey($app, $key, false)) { @@ -177,16 +132,6 @@ class AppConfig implements IAppConfig { } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $prefix config keys prefix to search - * @param bool $filtered TRUE to hide sensitive config values. Value are replaced by {@see IConfig::SENSITIVE_VALUE} - * - * @return array<string, string|int|float|bool|array> [configKey => configValue] - * @since 29.0.0 - */ public function getAllValues(string $app, string $prefix = '', bool $filtered = false): array { $this->assertParams($app, $prefix); // if we want to filter values, we need to get sensitivity @@ -222,16 +167,6 @@ class AppConfig implements IAppConfig { return $result; } - /** - * @inheritDoc - * - * @param string $key config key - * @param bool $lazy search within lazy loaded config - * @param int|null $typedAs enforce type for the returned values ({@see self::VALUE_STRING} and others) - * - * @return array<string, string|int|float|bool|array> [appId => configValue] - * @since 29.0.0 - */ public function searchValues(string $key, bool $lazy = false, ?int $typedAs = null): array { $this->assertParams('', $key, true); $this->loadConfig($lazy); @@ -298,20 +233,6 @@ class AppConfig implements IAppConfig { ); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param string $default default value - * @param bool $lazy search within lazy loaded config - * - * @return string stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function getValueString( string $app, string $key, @@ -321,20 +242,6 @@ class AppConfig implements IAppConfig { return $this->getTypedValue($app, $key, $default, $lazy, self::VALUE_STRING); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param int $default default value - * @param bool $lazy search within lazy loaded config - * - * @return int stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function getValueInt( string $app, string $key, @@ -344,57 +251,15 @@ class AppConfig implements IAppConfig { return (int)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_INT); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param float $default default value - * @param bool $lazy search within lazy loaded config - * - * @return float stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float { return (float)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_FLOAT); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param bool $default default value - * @param bool $lazy search within lazy loaded config - * - * @return bool stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool { $b = strtolower($this->getTypedValue($app, $key, $default ? 'true' : 'false', $lazy, self::VALUE_BOOL)); return in_array($b, ['1', 'true', 'yes', 'on']); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param array $default default value - * @param bool $lazy search within lazy loaded config - * - * @return array stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function getValueArray( string $app, string $key, @@ -470,21 +335,6 @@ class AppConfig implements IAppConfig { return $value; } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * - * @return int type of the value - * @throws AppConfigUnknownKeyException if config key is not known - * @since 29.0.0 - * @see VALUE_STRING - * @see VALUE_INT - * @see VALUE_FLOAT - * @see VALUE_BOOL - * @see VALUE_ARRAY - */ public function getValueType(string $app, string $key, ?bool $lazy = null): int { $this->assertParams($app, $key); $this->loadConfig($lazy); @@ -538,20 +388,6 @@ class AppConfig implements IAppConfig { } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param string $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function setValueString( string $app, string $key, @@ -568,20 +404,6 @@ class AppConfig implements IAppConfig { ); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param int $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function setValueInt( string $app, string $key, @@ -602,20 +424,6 @@ class AppConfig implements IAppConfig { ); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param float $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function setValueFloat( string $app, string $key, @@ -632,19 +440,6 @@ class AppConfig implements IAppConfig { ); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param bool $value config value - * @param bool $lazy set config as lazy loaded - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function setValueBool( string $app, string $key, @@ -660,21 +455,6 @@ class AppConfig implements IAppConfig { ); } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param array $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @throws JsonException - * @since 29.0.0 - * @see IAppConfig for explanation about lazy loading - */ public function setValueArray( string $app, string $key, @@ -879,16 +659,6 @@ class AppConfig implements IAppConfig { } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param bool $sensitive TRUE to set as sensitive, FALSE to unset - * - * @return bool TRUE if entry was found in database and an update was necessary - * @since 29.0.0 - */ public function updateSensitive(string $app, string $key, bool $sensitive): bool { $this->assertParams($app, $key); $this->loadConfigAll(); @@ -938,16 +708,6 @@ class AppConfig implements IAppConfig { return true; } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * @param bool $lazy TRUE to set as lazy loaded, FALSE to unset - * - * @return bool TRUE if entry was found in database and an update was necessary - * @since 29.0.0 - */ public function updateLazy(string $app, string $key, bool $lazy): bool { $this->assertParams($app, $key); $this->loadConfigAll(); @@ -973,16 +733,6 @@ class AppConfig implements IAppConfig { return true; } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * - * @return array - * @throws AppConfigUnknownKeyException if config key is not known in database - * @since 29.0.0 - */ public function getDetails(string $app, string $key): array { $this->assertParams($app, $key); $this->loadConfigAll(); @@ -1023,13 +773,6 @@ class AppConfig implements IAppConfig { ]; } - /** - * @param string $type - * - * @return int - * @throws AppConfigIncorrectTypeException - * @since 29.0.0 - */ public function convertTypeToInt(string $type): int { return match (strtolower($type)) { 'mixed' => IAppConfig::VALUE_MIXED, @@ -1042,13 +785,6 @@ class AppConfig implements IAppConfig { }; } - /** - * @param int $type - * - * @return string - * @throws AppConfigIncorrectTypeException - * @since 29.0.0 - */ public function convertTypeToString(int $type): string { $type &= ~self::VALUE_SENSITIVE; @@ -1063,14 +799,6 @@ class AppConfig implements IAppConfig { }; } - /** - * @inheritDoc - * - * @param string $app id of the app - * @param string $key config key - * - * @since 29.0.0 - */ public function deleteKey(string $app, string $key): void { $this->assertParams($app, $key); $qb = $this->connection->getQueryBuilder(); @@ -1083,13 +811,6 @@ class AppConfig implements IAppConfig { unset($this->fastCache[$app][$key]); } - /** - * @inheritDoc - * - * @param string $app id of the app - * - * @since 29.0.0 - */ public function deleteApp(string $app): void { $this->assertParams($app); $qb = $this->connection->getQueryBuilder(); @@ -1100,13 +821,6 @@ class AppConfig implements IAppConfig { $this->clearCache(); } - /** - * @inheritDoc - * - * @param bool $reload set to TRUE to refill cache instantly after clearing it - * - * @since 29.0.0 - */ public function clearCache(bool $reload = false): void { $this->lazyLoaded = $this->fastLoaded = false; $this->lazyCache = $this->fastCache = $this->valueTypes = []; @@ -1332,15 +1046,6 @@ class AppConfig implements IAppConfig { } - /** - * get multiple values, either the app or key can be used as wildcard by setting it to false - * - * @param string|false $app - * @param string|false $key - * - * @return array|false - * @deprecated 29.0.0 use {@see getAllValues()} - */ public function getValues($app, $key) { if (($app !== false) === ($key !== false)) { return false; @@ -1354,14 +1059,6 @@ class AppConfig implements IAppConfig { } } - /** - * get all values of the app or and filters out sensitive data - * - * @param string $app - * - * @return array - * @deprecated 29.0.0 use {@see getAllValues()} - */ public function getFilteredValues($app) { return $this->getAllValues($app, filtered: true); } diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index a96e050c0e6..11efebeba0d 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -336,17 +336,10 @@ class DIContainer extends SimpleContainer implements IAppContainer { }); } - /** - * @return \OCP\IServerContainer - */ public function getServer() { return $this->server; } - /** - * @param string $middleWare - * @return boolean|null - */ public function registerMiddleWare($middleWare) { if (in_array($middleWare, $this->middleWares, true) !== false) { return false; @@ -354,10 +347,6 @@ class DIContainer extends SimpleContainer implements IAppContainer { $this->middleWares[] = $middleWare; } - /** - * used to return the appname of the set application - * @return string the name of your application - */ public function getAppName() { return $this->query('AppName'); } @@ -383,11 +372,6 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getSession()->get('user_id'); } - /** - * Register a capability - * - * @param string $serviceName e.g. 'OCA\Files\Capabilities' - */ public function registerCapability($serviceName) { $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { return $this->query($serviceName); diff --git a/lib/private/AppFramework/Http/Output.php b/lib/private/AppFramework/Http/Output.php index ff0ef1c15ca..8efb60eb291 100644 --- a/lib/private/AppFramework/Http/Output.php +++ b/lib/private/AppFramework/Http/Output.php @@ -23,18 +23,10 @@ class Output implements IOutput { $this->webRoot = $webRoot; } - /** - * @param string $out - */ public function setOutput($out) { print($out); } - /** - * @param string|resource $path or file handle - * - * @return bool false if an error occurred - */ public function setReadfile($path) { if (is_resource($path)) { $output = fopen('php://output', 'w'); @@ -44,36 +36,18 @@ class Output implements IOutput { } } - /** - * @param string $header - */ public function setHeader($header) { header($header); } - /** - * @param int $code sets the http status code - */ public function setHttpResponseCode($code) { http_response_code($code); } - /** - * @return int returns the current http response code - */ public function getHttpResponseCode() { return http_response_code(); } - /** - * @param string $name - * @param string $value - * @param int $expire - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly - */ public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') { $path = $this->webRoot ? : '/'; diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 4bbeabb7aae..d018058dc2f 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -250,14 +250,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { throw new \RuntimeException('You cannot change the contents of the request object'); } - /** - * Returns the value for a specific http header. - * - * This method returns an empty string if the header did not exist. - * - * @param string $name - * @return string - */ public function getHeader(string $name): string { $name = strtoupper(str_replace('-', '_', $name)); if (isset($this->server['HTTP_' . $name])) { @@ -279,65 +271,28 @@ class Request implements \ArrayAccess, \Countable, IRequest { return ''; } - /** - * Lets you access post and get parameters by the index - * In case of json requests the encoded json body is accessed - * - * @param string $key the key which you want to access in the URL Parameter - * placeholder, $_POST or $_GET array. - * The priority how they're returned is the following: - * 1. URL parameters - * 2. POST parameters - * 3. GET parameters - * @param mixed $default If the key is not found, this value will be returned - * @return mixed the content of the array - */ public function getParam(string $key, $default = null) { return isset($this->parameters[$key]) ? $this->parameters[$key] : $default; } - /** - * Returns all params that were received, be it from the request - * (as GET or POST) or through the URL by the route - * @return array the array with all parameters - */ public function getParams(): array { return is_array($this->parameters) ? $this->parameters : []; } - /** - * Returns the method of the request - * @return string the method of the request (POST, GET, etc) - */ public function getMethod(): string { return $this->method; } - /** - * Shortcut for accessing an uploaded file through the $_FILES array - * @param string $key the key that will be taken from the $_FILES array - * @return array the file in the $_FILES element - */ public function getUploadedFile(string $key) { return isset($this->files[$key]) ? $this->files[$key] : null; } - /** - * Shortcut for getting env variables - * @param string $key the key that will be taken from the $_ENV array - * @return array the value in the $_ENV element - */ public function getEnv(string $key) { return isset($this->env[$key]) ? $this->env[$key] : null; } - /** - * Shortcut for getting cookie variables - * @param string $key the key that will be taken from the $_COOKIE array - * @return string the value in the $_COOKIE element - */ public function getCookie(string $key) { return isset($this->cookies[$key]) ? $this->cookies[$key] : null; } @@ -414,10 +369,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { } - /** - * Checks if the CSRF check was correct - * @return bool true if CSRF check passed - */ public function passesCSRFCheck(): bool { if ($this->csrfTokenManager === null) { return false; @@ -487,13 +438,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return $prefix.$name; } - /** - * Checks if the strict cookie has been sent with the request if the request - * is including any cookies. - * - * @return bool - * @since 9.1.0 - */ public function passesStrictCookieCheck(): bool { if (!$this->cookieCheckRequired()) { return true; @@ -507,13 +451,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return false; } - /** - * Checks if the lax cookie has been sent with the request if the request - * is including any cookies. - * - * @return bool - * @since 9.1.0 - */ public function passesLaxCookieCheck(): bool { if (!$this->cookieCheckRequired()) { return true; @@ -527,11 +464,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { } - /** - * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging - * If `mod_unique_id` is installed this value will be taken. - * @return string - */ public function getId(): string { return $this->requestId->getId(); } @@ -552,13 +484,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { } } - /** - * Returns the remote address, if the connection came from a trusted proxy - * and `forwarded_for_headers` has been configured then the IP address - * specified in this header will be returned instead. - * Do always use this instead of $_SERVER['REMOTE_ADDR'] - * @return string IP address - */ public function getRemoteAddress(): string { $remoteAddress = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : ''; $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); @@ -611,11 +536,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return $regex === '//' || preg_match($regex, $remoteAddr) === 1; } - /** - * Returns the server protocol. It respects one or more reverse proxies servers - * and load balancers - * @return string Server protocol (http or https) - */ public function getServerProtocol(): string { if ($this->config->getSystemValueString('overwriteprotocol') !== '' && $this->isOverwriteCondition()) { @@ -645,11 +565,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return 'http'; } - /** - * Returns the used HTTP protocol. - * - * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0. - */ public function getHttpProtocol(): string { $claimedProtocol = $this->server['SERVER_PROTOCOL']; @@ -670,11 +585,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return 'HTTP/1.1'; } - /** - * Returns the request uri, even if the website uses one or more - * reverse proxies - * @return string - */ public function getRequestUri(): string { $uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : ''; if ($this->config->getSystemValueString('overwritewebroot') !== '' && $this->isOverwriteCondition()) { @@ -683,11 +593,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return $uri; } - /** - * Get raw PathInfo from request (not urldecoded) - * @throws \Exception - * @return string Path info - */ public function getRawPathInfo(): string { $requestUri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : ''; // remove too many slashes - can be caused by reverse proxy configuration @@ -728,21 +633,11 @@ class Request implements \ArrayAccess, \Countable, IRequest { } } - /** - * Get PathInfo from request - * @throws \Exception - * @return string|false Path info or false when not found - */ public function getPathInfo() { $pathInfo = $this->getRawPathInfo(); return \Sabre\HTTP\decodePath($pathInfo); } - /** - * Returns the script name, even if the website uses one or more - * reverse proxies - * @return string the script name - */ public function getScriptName(): string { $name = $this->server['SCRIPT_NAME']; $overwriteWebRoot = $this->config->getSystemValueString('overwritewebroot'); @@ -755,11 +650,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return $name; } - /** - * Checks whether the user agent matches a given regex - * @param array $agent array of agent names - * @return bool true if at least one of the given agent matches, false otherwise - */ public function isUserAgent(array $agent): bool { if (!isset($this->server['HTTP_USER_AGENT'])) { return false; @@ -772,11 +662,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { return false; } - /** - * Returns the unverified server host from the headers without checking - * whether it is a trusted domain - * @return string Server host - */ public function getInsecureServerHost(): string { if ($this->fromTrustedProxy() && $this->getOverwriteHost() !== null) { return $this->getOverwriteHost(); @@ -802,11 +687,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { } - /** - * Returns the server host from the headers, or the first configured - * trusted domain if the host isn't in the trusted list - * @return string Server host - */ public function getServerHost(): string { // overwritehost is always trusted $host = $this->getOverwriteHost(); diff --git a/lib/private/AppFramework/Http/RequestId.php b/lib/private/AppFramework/Http/RequestId.php index c3a99c93591..6953cf3f9cb 100644 --- a/lib/private/AppFramework/Http/RequestId.php +++ b/lib/private/AppFramework/Http/RequestId.php @@ -20,11 +20,6 @@ class RequestId implements IRequestId { $this->secureRandom = $secureRandom; } - /** - * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging - * If `mod_unique_id` is installed this value will be taken. - * @return string - */ public function getId(): string { if (empty($this->requestId)) { $validChars = ISecureRandom::CHAR_ALPHANUMERIC; diff --git a/lib/private/AppFramework/Logger.php b/lib/private/AppFramework/Logger.php index 4ae4e6cae34..0da4ac8289a 100644 --- a/lib/private/AppFramework/Logger.php +++ b/lib/private/AppFramework/Logger.php @@ -36,72 +36,42 @@ class Logger implements ILogger { return $context; } - /** - * @deprecated - */ public function emergency(string $message, array $context = []) { $this->logger->emergency($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function alert(string $message, array $context = []) { $this->logger->alert($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function critical(string $message, array $context = []) { $this->logger->critical($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function error(string $message, array $context = []) { $this->logger->emergency($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function warning(string $message, array $context = []) { $this->logger->warning($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function notice(string $message, array $context = []) { $this->logger->notice($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function info(string $message, array $context = []) { $this->logger->info($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function debug(string $message, array $context = []) { $this->logger->debug($message, $this->extendContext($context)); } - /** - * @deprecated - */ public function log(int $level, string $message, array $context = []) { $this->logger->log($level, $message, $this->extendContext($context)); } - /** - * @deprecated - */ public function logException(\Throwable $exception, array $context = []) { $this->logger->logException($exception, $this->extendContext($context)); } diff --git a/lib/private/AppFramework/Services/AppConfig.php b/lib/private/AppFramework/Services/AppConfig.php index e47bbc429d0..28970948217 100644 --- a/lib/private/AppFramework/Services/AppConfig.php +++ b/lib/private/AppFramework/Services/AppConfig.php @@ -8,11 +8,7 @@ declare(strict_types=1); */ namespace OC\AppFramework\Services; -use InvalidArgumentException; -use JsonException; use OCP\AppFramework\Services\IAppConfig; -use OCP\Exceptions\AppConfigTypeConflictException; -use OCP\Exceptions\AppConfigUnknownKeyException; use OCP\IConfig; class AppConfig implements IAppConfig { @@ -24,94 +20,31 @@ class AppConfig implements IAppConfig { ) { } - /** - * @inheritDoc - * - * @return string[] list of stored config keys - * @since 20.0.0 - */ public function getAppKeys(): array { return $this->appConfig->getKeys($this->appName); } - /** - * @inheritDoc - * - * @param string $key config key - * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config - * - * @return bool TRUE if key exists - * @since 29.0.0 - */ public function hasAppKey(string $key, ?bool $lazy = false): bool { return $this->appConfig->hasKey($this->appName, $key, $lazy); } - /** - * @param string $key config key - * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config - * - * @return bool - * @throws AppConfigUnknownKeyException if config key is not known - * @since 29.0.0 - */ public function isSensitive(string $key, ?bool $lazy = false): bool { return $this->appConfig->isSensitive($this->appName, $key, $lazy); } - /** - * @inheritDoc - * - * @param string $key config key - * - * @return bool TRUE if config is lazy loaded - * @throws AppConfigUnknownKeyException if config key is not known - * @see \OCP\IAppConfig for details about lazy loading - * @since 29.0.0 - */ public function isLazy(string $key): bool { return $this->appConfig->isLazy($this->appName, $key); } - /** - * @inheritDoc - * - * @param string $key config keys prefix to search - * @param bool $filtered TRUE to hide sensitive config values. Value are replaced by {@see IConfig::SENSITIVE_VALUE} - * - * @return array<string, string|int|float|bool|array> [configKey => configValue] - * @since 29.0.0 - */ public function getAllAppValues(string $key = '', bool $filtered = false): array { return $this->appConfig->getAllValues($this->appName, $key, $filtered); } - /** - * @inheritDoc - * - * @param string $key the key of the value, under which will be saved - * @param string $value the value that should be stored - * @since 20.0.0 - * @deprecated 29.0.0 use {@see setAppValueString()} - */ public function setAppValue(string $key, string $value): void { /** @psalm-suppress InternalMethod */ $this->appConfig->setValueMixed($this->appName, $key, $value); } - /** - * @inheritDoc - * - * @param string $key config key - * @param string $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function setAppValueString( string $key, string $value, @@ -121,19 +54,6 @@ class AppConfig implements IAppConfig { return $this->appConfig->setValueString($this->appName, $key, $value, $lazy, $sensitive); } - /** - * @inheritDoc - * - * @param string $key config key - * @param int $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function setAppValueInt( string $key, int $value, @@ -143,19 +63,6 @@ class AppConfig implements IAppConfig { return $this->appConfig->setValueInt($this->appName, $key, $value, $lazy, $sensitive); } - /** - * @inheritDoc - * - * @param string $key config key - * @param float $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function setAppValueFloat( string $key, float $value, @@ -165,18 +72,6 @@ class AppConfig implements IAppConfig { return $this->appConfig->setValueFloat($this->appName, $key, $value, $lazy, $sensitive); } - /** - * @inheritDoc - * - * @param string $key config key - * @param bool $value config value - * @param bool $lazy set config as lazy loaded - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function setAppValueBool( string $key, bool $value, @@ -185,20 +80,6 @@ class AppConfig implements IAppConfig { return $this->appConfig->setValueBool($this->appName, $key, $value, $lazy); } - /** - * @inheritDoc - * - * @param string $key config key - * @param array $value config value - * @param bool $lazy set config as lazy loaded - * @param bool $sensitive if TRUE value will be hidden when listing config values. - * - * @return bool TRUE if value was different, therefor updated in database - * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one - * @throws JsonException - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function setAppValueArray( string $key, array $value, @@ -208,120 +89,36 @@ class AppConfig implements IAppConfig { return $this->appConfig->setValueArray($this->appName, $key, $value, $lazy, $sensitive); } - /** - * @param string $key - * @param string $default - * - * @since 20.0.0 - * @deprecated 29.0.0 use {@see getAppValueString()} - * @return string - */ public function getAppValue(string $key, string $default = ''): string { /** @psalm-suppress InternalMethod */ /** @psalm-suppress UndefinedInterfaceMethod */ return $this->appConfig->getValueMixed($this->appName, $key, $default); } - /** - * @inheritDoc - * - * @param string $key config key - * @param string $default default value - * @param bool $lazy search within lazy loaded config - * - * @return string stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function getAppValueString(string $key, string $default = '', bool $lazy = false): string { return $this->appConfig->getValueString($this->appName, $key, $default, $lazy); } - /** - * @inheritDoc - * - * @param string $key config key - * @param int $default default value - * @param bool $lazy search within lazy loaded config - * - * @return int stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function getAppValueInt(string $key, int $default = 0, bool $lazy = false): int { return $this->appConfig->getValueInt($this->appName, $key, $default, $lazy); } - /** - * @inheritDoc - * - * @param string $key config key - * @param float $default default value - * @param bool $lazy search within lazy loaded config - * - * @return float stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function getAppValueFloat(string $key, float $default = 0, bool $lazy = false): float { return $this->appConfig->getValueFloat($this->appName, $key, $default, $lazy); } - /** - * @inheritDoc - * - * @param string $key config key - * @param bool $default default value - * @param bool $lazy search within lazy loaded config - * - * @return bool stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function getAppValueBool(string $key, bool $default = false, bool $lazy = false): bool { return $this->appConfig->getValueBool($this->appName, $key, $default, $lazy); } - /** - * @inheritDoc - * - * @param string $key config key - * @param array $default default value - * @param bool $lazy search within lazy loaded config - * - * @return array stored config value or $default if not set in database - * @throws InvalidArgumentException if one of the argument format is invalid - * @throws AppConfigTypeConflictException in case of conflict with the value type set in database - * @since 29.0.0 - * @see \OCP\IAppConfig for explanation about lazy loading - */ public function getAppValueArray(string $key, array $default = [], bool $lazy = false): array { return $this->appConfig->getValueArray($this->appName, $key, $default, $lazy); } - /** - * @inheritDoc - * - * @param string $key the key of the value, under which it was saved - * @since 20.0.0 - */ public function deleteAppValue(string $key): void { $this->appConfig->deleteKey($this->appName, $key); } - /** - * @inheritDoc - * - * @since 20.0.0 - */ public function deleteAppValues(): void { $this->appConfig->deleteApp($this->appName); } diff --git a/lib/private/AppFramework/Utility/ControllerMethodReflector.php b/lib/private/AppFramework/Utility/ControllerMethodReflector.php index 2031327dfae..b8a6233c0fd 100644 --- a/lib/private/AppFramework/Utility/ControllerMethodReflector.php +++ b/lib/private/AppFramework/Utility/ControllerMethodReflector.php @@ -19,10 +19,6 @@ class ControllerMethodReflector implements IControllerMethodReflector { private $parameters = []; private array $ranges = []; - /** - * @param object $object an object or classname - * @param string $method the method which we want to inspect - */ public function reflect($object, string $method) { $reflection = new \ReflectionMethod($object, $method); $docs = $reflection->getDocComment(); @@ -79,13 +75,6 @@ class ControllerMethodReflector implements IControllerMethodReflector { } } - /** - * Inspects the PHPDoc parameters for types - * @param string $parameter the parameter whose type comments should be - * parsed - * @return string|null type in the type parameters (@param int $something) - * would return int or null if not existing - */ public function getType(string $parameter) { if (array_key_exists($parameter, $this->types)) { return $this->types[$parameter]; @@ -102,18 +91,10 @@ class ControllerMethodReflector implements IControllerMethodReflector { return null; } - /** - * @return array the arguments of the method with key => default value - */ public function getParameters(): array { return $this->parameters; } - /** - * Check if a method contains an annotation - * @param string $name the name of the annotation - * @return bool true if the annotation is found - */ public function hasAnnotation(string $name): bool { $name = strtolower($name); return array_key_exists($name, $this->annotations); diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index 56de4a34cf6..5933a30833c 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -30,14 +30,6 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { $this->container = new Container(); } - /** - * @template T - * @param class-string<T>|string $id - * @return T|mixed - * @psalm-template S as class-string<T>|string - * @psalm-param S $id - * @psalm-return (S is class-string<T> ? T : mixed) - */ public function get(string $id): mixed { return $this->query($id); } @@ -131,23 +123,10 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { throw new QueryNotFoundException('Could not resolve ' . $name . '!'); } - /** - * @param string $name - * @param mixed $value - */ public function registerParameter($name, $value) { $this[$name] = $value; } - /** - * The given closure is call the first time the given service is queried. - * The closure has to return the instance for the given service. - * Created instance will be cached in case $shared is true. - * - * @param string $name name of the service to register another backend for - * @param Closure $closure the closure to be called on service creation - * @param bool $shared - */ public function registerService($name, Closure $closure, $shared = true) { $wrapped = function () use ($closure) { return $closure($this); @@ -163,13 +142,6 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { } } - /** - * Shortcut for returning a service from a service under a different key, - * e.g. to tell the container to return a class when queried for an - * interface - * @param string $alias the alias that should be registered - * @param string $target the target that should be resolved instead - */ public function registerAlias($alias, $target) { $this->registerService($alias, function (ContainerInterface $container) use ($target) { return $container->get($target); diff --git a/lib/private/AppFramework/Utility/TimeFactory.php b/lib/private/AppFramework/Utility/TimeFactory.php index 0584fd05ef9..ed6c5f93213 100644 --- a/lib/private/AppFramework/Utility/TimeFactory.php +++ b/lib/private/AppFramework/Utility/TimeFactory.php @@ -24,22 +24,10 @@ class TimeFactory implements ITimeFactory { $this->timezone = new \DateTimeZone('UTC'); } - /** - * @return int the result of a call to time() - * @since 8.0.0 - * @deprecated 26.0.0 {@see ITimeFactory::now()} - */ public function getTime(): int { return time(); } - /** - * @param string $time - * @param \DateTimeZone $timezone - * @return \DateTime - * @since 15.0.0 - * @deprecated 26.0.0 {@see ITimeFactory::now()} - */ public function getDateTime(string $time = 'now', ?\DateTimeZone $timezone = null): \DateTime { return new \DateTime($time, $timezone); } diff --git a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php index 96878c44123..d5939f56e09 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php @@ -48,9 +48,6 @@ class RemoteWipeEmailListener implements IEventListener { $this->logger = $logger; } - /** - * @param Event $event - */ public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $uid = $event->getToken()->getUID(); diff --git a/lib/private/Authentication/LoginCredentials/Credentials.php b/lib/private/Authentication/LoginCredentials/Credentials.php index 2d7ed3adfd0..518ae1319d7 100644 --- a/lib/private/Authentication/LoginCredentials/Credentials.php +++ b/lib/private/Authentication/LoginCredentials/Credentials.php @@ -28,23 +28,14 @@ class Credentials implements ICredentials { $this->password = $password; } - /** - * @return string - */ public function getUID() { return $this->uid; } - /** - * @return string - */ public function getLoginName() { return $this->loginName; } - /** - * @return string - */ public function getPassword() { return $this->password; } diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php index bd39dd11460..307501515ae 100644 --- a/lib/private/Authentication/LoginCredentials/Store.php +++ b/lib/private/Authentication/LoginCredentials/Store.php @@ -57,12 +57,6 @@ class Store implements IStore { $this->session = $session; } - /** - * @since 12 - * - * @return ICredentials the login credentials of the current user - * @throws CredentialsUnavailableException - */ public function getLoginCredentials(): ICredentials { if ($this->tokenProvider === null) { throw new CredentialsUnavailableException(); diff --git a/lib/private/Authentication/Notifications/Notifier.php b/lib/private/Authentication/Notifications/Notifier.php index a81e385d8b1..834c8e43d5b 100644 --- a/lib/private/Authentication/Notifications/Notifier.php +++ b/lib/private/Authentication/Notifications/Notifier.php @@ -21,9 +21,6 @@ class Notifier implements INotifier { $this->factory = $l10nFactory; } - /** - * @inheritDoc - */ public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'auth') { // Not my app => throw @@ -56,22 +53,10 @@ class Notifier implements INotifier { } } - /** - * Identifier of the notifier, only use [a-z0-9_] - * - * @return string - * @since 17.0.0 - */ public function getID(): string { return 'auth'; } - /** - * Human readable name describing the notifier - * - * @return string - * @since 17.0.0 - */ public function getName(): string { return $this->factory->get('lib')->t('Authentication'); } diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php index 6953f47b004..bc4521e2421 100644 --- a/lib/private/Authentication/Token/Manager.php +++ b/lib/private/Authentication/Token/Manager.php @@ -105,14 +105,6 @@ class Manager implements IProvider, OCPIProvider { return $this->publicKeyTokenProvider->getTokenByUser($uid); } - /** - * Get a token by token - * - * @param string $tokenId - * @throws InvalidTokenException - * @throws \RuntimeException when OpenSSL reports a problem - * @return OCPIToken - */ public function getToken(string $tokenId): OCPIToken { try { return $this->publicKeyTokenProvider->getToken($tokenId); diff --git a/lib/private/Avatar/Avatar.php b/lib/private/Avatar/Avatar.php index bf29d57b88d..52dcf699031 100644 --- a/lib/private/Avatar/Avatar.php +++ b/lib/private/Avatar/Avatar.php @@ -58,9 +58,6 @@ abstract class Avatar implements IAvatar { return implode('', $firstTwoLetters); } - /** - * @inheritdoc - */ public function get(int $size = 64, bool $darkTheme = false) { try { $file = $this->getFile($size, $darkTheme); @@ -227,9 +224,6 @@ abstract class Avatar implements IAvatar { return intval($final % $maximum); } - /** - * @return Color Object containing r g b int in the range [0, 255] - */ public function avatarBackgroundColor(string $hash): Color { // Normalize hash $hash = strtolower($hash); diff --git a/lib/private/Avatar/AvatarManager.php b/lib/private/Avatar/AvatarManager.php index 60a3d358bf4..d32bb4096eb 100644 --- a/lib/private/Avatar/AvatarManager.php +++ b/lib/private/Avatar/AvatarManager.php @@ -40,16 +40,6 @@ class AvatarManager implements IAvatarManager { ) { } - /** - * return a user specific instance of \OCP\IAvatar - * - * If the user is disabled a guest avatar will be returned - * - * @see \OCP\IAvatar - * @param string $userId the ownCloud user id - * @throws \Exception In case the username is potentially dangerous - * @throws NotFoundException In case there is no user folder yet - */ public function getAvatar(string $userId): IAvatar { $user = $this->userManager->get($userId); if ($user === null) { @@ -123,11 +113,6 @@ class AvatarManager implements IAvatarManager { $this->config->deleteUserValue($userId, 'avatar', 'generated'); } - /** - * Returns a GuestAvatar. - * - * @param string $name The guest name, e.g. "Albert". - */ public function getGuestAvatar(string $name): IAvatar { return new GuestAvatar($name, $this->logger); } diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index dc8e33c743c..54cad7b6a10 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -68,10 +68,6 @@ class JobList implements IJobList { $this->add($job, $argument, $runAfter); } - /** - * @param IJob|string $job - * @param mixed $argument - */ public function remove($job, $argument = null): void { $class = ($job instanceof IJob) ? get_class($job) : $job; @@ -107,12 +103,6 @@ class JobList implements IJobList { $query->executeStatement(); } - /** - * check if a job is in the list - * - * @param IJob|class-string<IJob> $job - * @param mixed $argument - */ public function has($job, $argument): bool { $class = ($job instanceof IJob) ? get_class($job) : $job; $argument = json_encode($argument); @@ -138,10 +128,6 @@ class JobList implements IJobList { : iterator_to_array($iterable); } - /** - * @param IJob|class-string<IJob>|null $job - * @return iterable<IJob> Avoid to store these objects as they may share a Singleton instance. You should instead use these IJobs instances while looping on the iterable. - */ public function getJobsIterator($job, ?int $limit, int $offset): iterable { $query = $this->connection->getQueryBuilder(); $query->select('*') @@ -165,9 +151,6 @@ class JobList implements IJobList { $result->closeCursor(); } - /** - * @inheritDoc - */ public function getNext(bool $onlyTimeSensitive = false, ?array $jobClasses = null): ?IJob { $query = $this->connection->getQueryBuilder(); $query->select('*') @@ -245,9 +228,6 @@ class JobList implements IJobList { } } - /** - * @return ?IJob The job matching the id. Beware that this object may be a singleton and may be modified by the next call to buildJob. - */ public function getById(int $id): ?IJob { $row = $this->getDetailsById($id); @@ -311,17 +291,11 @@ class JobList implements IJobList { } } - /** - * set the job that was last ran - */ public function setLastJob(IJob $job): void { $this->unlockJob($job); $this->config->setAppValue('backgroundjob', 'lastjob', (string)$job->getId()); } - /** - * Remove the reservation for a job - */ public function unlockJob(IJob $job): void { $query = $this->connection->getQueryBuilder(); $query->update('jobs') @@ -330,9 +304,6 @@ class JobList implements IJobList { $query->executeStatement(); } - /** - * set the lastRun of $job to now - */ public function setLastRun(IJob $job): void { $query = $this->connection->getQueryBuilder(); $query->update('jobs') @@ -347,9 +318,6 @@ class JobList implements IJobList { $query->executeStatement(); } - /** - * @param int $timeTaken - */ public function setExecutionTime(IJob $job, $timeTaken): void { $query = $this->connection->getQueryBuilder(); $query->update('jobs') @@ -359,11 +327,6 @@ class JobList implements IJobList { $query->executeStatement(); } - /** - * Reset the $job so it executes on the next trigger - * - * @since 23.0.0 - */ public function resetBackgroundJob(IJob $job): void { $query = $this->connection->getQueryBuilder(); $query->update('jobs') diff --git a/lib/private/BinaryFinder.php b/lib/private/BinaryFinder.php index f7ac7a5195c..67ca8746073 100644 --- a/lib/private/BinaryFinder.php +++ b/lib/private/BinaryFinder.php @@ -23,11 +23,6 @@ class BinaryFinder implements IBinaryFinder { $this->cache = $cacheFactory->createLocal('findBinaryPath'); } - /** - * Try to find a program - * - * @return false|string - */ public function findBinaryPath(string $program) { $result = $this->cache->get($program); if ($result !== null) { diff --git a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php index 1d0a502df6d..ac0ba17ee32 100644 --- a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php +++ b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php @@ -32,11 +32,6 @@ class GenerateBlurhashMetadata implements IEventListener { private const COMPONENTS_X = 4; private const COMPONENTS_Y = 3; - /** - * @throws NotPermittedException - * @throws GenericFileException - * @throws LockedException - */ public function handle(Event $event): void { if (!($event instanceof MetadataLiveEvent) && !($event instanceof MetadataBackgroundEvent)) { diff --git a/lib/private/Cache/CappedMemoryCache.php b/lib/private/Cache/CappedMemoryCache.php index 2c2eab3209a..88a2e5780fa 100644 --- a/lib/private/Cache/CappedMemoryCache.php +++ b/lib/private/Cache/CappedMemoryCache.php @@ -29,19 +29,10 @@ class CappedMemoryCache implements ICache, \ArrayAccess { return isset($this->cache[$key]); } - /** - * @return ?T - */ public function get($key) { return $this->cache[$key] ?? null; } - /** - * @param string $key - * @param T $value - * @param int $ttl - * @return bool - */ public function set($key, $value, $ttl = 0): bool { if (is_null($key)) { $this->cache[] = $value; diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php index 10152d0966b..4e082f4e4d7 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -43,11 +43,6 @@ class File implements ICache { } } - /** - * @param string $key - * @return mixed|null - * @throws \OC\ForbiddenException - */ public function get($key) { $result = null; if ($this->hasKey($key)) { @@ -72,13 +67,6 @@ class File implements ICache { return $result; } - /** - * @param string $key - * @param mixed $value - * @param int $ttl - * @return bool|mixed - * @throws \OC\ForbiddenException - */ public function set($key, $value, $ttl = 0) { $storage = $this->getStorage(); $result = false; @@ -101,11 +89,6 @@ class File implements ICache { return $result; } - /** - * @param string $key - * @return bool - * @throws \OC\ForbiddenException - */ public function hasKey($key) { $storage = $this->getStorage(); if ($storage && $storage->is_file($key) && $storage->isReadable($key)) { @@ -114,11 +97,6 @@ class File implements ICache { return false; } - /** - * @param string $key - * @return bool|mixed - * @throws \OC\ForbiddenException - */ public function remove($key) { $storage = $this->getStorage(); if (!$storage) { @@ -127,11 +105,6 @@ class File implements ICache { return $storage->unlink($key); } - /** - * @param string $prefix - * @return bool - * @throws \OC\ForbiddenException - */ public function clear($prefix = '') { $storage = $this->getStorage(); if ($storage and $storage->is_dir('/')) { diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index fa324273f5c..23b353dccc2 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -14,7 +14,6 @@ use OCP\Calendar\Exceptions\CalendarException; use OCP\Calendar\ICalendar; use OCP\Calendar\ICalendarProvider; use OCP\Calendar\ICalendarQuery; -use OCP\Calendar\ICreateFromString; use OCP\Calendar\IHandleImipMessage; use OCP\Calendar\IManager; use Psr\Container\ContainerInterface; @@ -46,19 +45,6 @@ class Manager implements IManager { ) { } - /** - * This function is used to search and find objects within the user's calendars. - * In case $pattern is empty all events/journals/todos will be returned. - * - * @param string $pattern which should match within the $searchProperties - * @param array $searchProperties defines the properties within the query pattern should match - * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] - * @param integer|null $limit - limit number of search results - * @param integer|null $offset - offset for paging of search results - * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs - * @since 13.0.0 - */ public function search( $pattern, array $searchProperties = [], @@ -79,60 +65,28 @@ class Manager implements IManager { return $result; } - /** - * Check if calendars are available - * - * @return bool true if enabled, false if not - * @since 13.0.0 - */ public function isEnabled(): bool { return !empty($this->calendars) || !empty($this->calendarLoaders); } - /** - * Registers a calendar - * - * @since 13.0.0 - */ public function registerCalendar(ICalendar $calendar): void { $this->calendars[$calendar->getKey()] = $calendar; } - /** - * Unregisters a calendar - * - * @since 13.0.0 - */ public function unregisterCalendar(ICalendar $calendar): void { unset($this->calendars[$calendar->getKey()]); } - /** - * In order to improve lazy loading a closure can be registered which will be called in case - * calendars are actually requested - * - * @since 13.0.0 - */ public function register(\Closure $callable): void { $this->calendarLoaders[] = $callable; } - /** - * @return ICalendar[] - * - * @since 13.0.0 - */ public function getCalendars(): array { $this->loadCalendars(); return array_values($this->calendars); } - /** - * removes all registered calendar instances - * - * @since 13.0.0 - */ public function clear(): void { $this->calendars = []; $this->calendarLoaders = []; @@ -148,9 +102,6 @@ class Manager implements IManager { $this->calendarLoaders = []; } - /** - * @return ICreateFromString[] - */ public function getCalendarsForPrincipal(string $principalUri, array $calendarUris = []): array { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -204,9 +155,6 @@ class Manager implements IManager { return new CalendarQuery($principalUri); } - /** - * @throws \OCP\DB\Exception - */ public function handleIMipReply( string $principalUri, string $sender, @@ -286,10 +234,6 @@ class Manager implements IManager { return true; } - /** - * @since 25.0.0 - * @throws \OCP\DB\Exception - */ public function handleIMipCancel( string $principalUri, string $sender, diff --git a/lib/private/Calendar/Resource/Manager.php b/lib/private/Calendar/Resource/Manager.php index db04e6a648a..cc26ca130a4 100644 --- a/lib/private/Calendar/Resource/Manager.php +++ b/lib/private/Calendar/Resource/Manager.php @@ -33,20 +33,10 @@ class Manager implements IManager { ) { } - /** - * Registers a resource backend - * - * @since 14.0.0 - */ public function registerBackend(string $backendClass): void { $this->backends[$backendClass] = $backendClass; } - /** - * Unregisters a resource backend - * - * @since 14.0.0 - */ public function unregisterBackend(string $backendClass): void { unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); } @@ -67,11 +57,6 @@ class Manager implements IManager { } } - /** - * @return IBackend[] - * @throws \OCP\AppFramework\QueryException - * @since 14.0.0 - */ public function getBackends():array { $this->fetchBootstrapBackends(); @@ -86,10 +71,6 @@ class Manager implements IManager { return array_values($this->initializedBackends); } - /** - * @param string $backendId - * @throws \OCP\AppFramework\QueryException - */ public function getBackend($backendId): ?IBackend { $backends = $this->getBackends(); foreach ($backends as $backend) { @@ -101,11 +82,6 @@ class Manager implements IManager { return null; } - /** - * removes all registered backend instances - * - * @since 14.0.0 - */ public function clear(): void { $this->backends = []; $this->initializedBackends = []; diff --git a/lib/private/Calendar/Room/Manager.php b/lib/private/Calendar/Room/Manager.php index 65897010f2a..f17e76f143d 100644 --- a/lib/private/Calendar/Room/Manager.php +++ b/lib/private/Calendar/Room/Manager.php @@ -33,21 +33,10 @@ class Manager implements IManager { ) { } - /** - * Registers a resource backend - * - * @since 14.0.0 - */ public function registerBackend(string $backendClass): void { $this->backends[$backendClass] = $backendClass; } - /** - * Unregisters a resource backend - * - * @param string $backendClass - * @since 14.0.0 - */ public function unregisterBackend(string $backendClass): void { unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); } @@ -68,11 +57,6 @@ class Manager implements IManager { } } - /** - * @return IBackend[] - * @throws \OCP\AppFramework\QueryException - * @since 14.0.0 - */ public function getBackends():array { $this->fetchBootstrapBackends(); @@ -93,10 +77,6 @@ class Manager implements IManager { return array_values($this->initializedBackends); } - /** - * @param string $backendId - * @throws \OCP\AppFramework\QueryException - */ public function getBackend($backendId): ?IBackend { $backends = $this->getBackends(); foreach ($backends as $backend) { @@ -108,11 +88,6 @@ class Manager implements IManager { return null; } - /** - * removes all registered backend instances - * - * @since 14.0.0 - */ public function clear(): void { $this->backends = []; $this->initializedBackends = []; diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 134970518bc..2cdbde9c967 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -54,9 +54,6 @@ class MailPlugin implements ISearchPlugin { } } - /** - * {@inheritdoc} - */ public function search($search, $limit, $offset, ISearchResult $searchResult): bool { if ($this->shareeEnumerationFullMatch && !$this->shareeEnumerationFullMatchEmail) { return false; diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index 78b57b52400..59dba1086cb 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -20,13 +20,6 @@ class Search implements ISearch { ) { } - /** - * @param string $search - * @param bool $lookup - * @param int|null $limit - * @param int|null $offset - * @throws \OCP\AppFramework\QueryException - */ public function search($search, array $shareTypes, $lookup, $limit, $offset): array { $hasMoreResults = false; diff --git a/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php b/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php index e468ad4eb4c..322cf3e9f44 100644 --- a/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php +++ b/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php @@ -31,9 +31,6 @@ class FileReferenceEventListener implements IEventListener { $eventDispatcher->addServiceListener(ShareCreatedEvent::class, FileReferenceEventListener::class); } - /** - * @inheritDoc - */ public function handle(Event $event): void { if ($event instanceof NodeDeletedEvent) { if ($event->getNode() instanceof NonExistingFolder || $event->getNode() instanceof NonExistingFile) { diff --git a/lib/private/Collaboration/Reference/ReferenceManager.php b/lib/private/Collaboration/Reference/ReferenceManager.php index 9287b66b2a2..76d33670d25 100644 --- a/lib/private/Collaboration/Reference/ReferenceManager.php +++ b/lib/private/Collaboration/Reference/ReferenceManager.php @@ -44,11 +44,6 @@ class ReferenceManager implements IReferenceManager { $this->cache = $cacheFactory->createDistributed('reference'); } - /** - * Extract a list of URLs from a text - * - * @return string[] - */ public function extractReferences(string $text): array { preg_match_all(IURLGenerator::URL_REGEX, $text, $matches); $references = $matches[0] ?? []; @@ -57,9 +52,6 @@ class ReferenceManager implements IReferenceManager { }, $references); } - /** - * Try to get a cached reference object from a reference string - */ public function getReferenceFromCache(string $referenceId, bool $public = false, string $sharingToken = ''): ?IReference { $matchedProvider = $this->getMatchedProvider($referenceId, $public); @@ -71,9 +63,6 @@ class ReferenceManager implements IReferenceManager { return $this->getReferenceByCacheKey($cacheKey); } - /** - * Try to get a cached reference object from a full cache key - */ public function getReferenceByCacheKey(string $cacheKey): ?IReference { $cached = $this->cache->get($cacheKey); if ($cached) { @@ -83,10 +72,6 @@ class ReferenceManager implements IReferenceManager { return null; } - /** - * Get a reference object from a reference string with a matching provider - * Use a cached reference if possible - */ public function resolveReference(string $referenceId, bool $public = false, $sharingToken = ''): ?IReference { $matchedProvider = $this->getMatchedProvider($referenceId, $public); @@ -159,9 +144,6 @@ class ReferenceManager implements IReferenceManager { ); } - /** - * Remove a specific cache entry from its key+prefix - */ public function invalidateCache(string $cachePrefix, ?string $cacheKey = null): void { if ($cacheKey === null) { // clear might be a heavy operation, so we only do it if there have actually been keys set @@ -205,9 +187,6 @@ class ReferenceManager implements IReferenceManager { return $this->providers; } - /** - * @inheritDoc - */ public function getDiscoverableProviders(): array { // preserve 0 based index to avoid returning an object in data responses return array_values( @@ -217,9 +196,6 @@ class ReferenceManager implements IReferenceManager { ); } - /** - * @inheritDoc - */ public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): bool { $providers = $this->getDiscoverableProviders(); $matchingProviders = array_filter($providers, static function (IDiscoverableReferenceProvider $provider) use ($providerId) { @@ -237,9 +213,6 @@ class ReferenceManager implements IReferenceManager { return false; } - /** - * @inheritDoc - */ public function getUserProviderTimestamps(): array { $user = $this->userSession->getUser(); if ($user === null) { diff --git a/lib/private/Collaboration/Reference/RenderReferenceEventListener.php b/lib/private/Collaboration/Reference/RenderReferenceEventListener.php index 9e6192314cb..655f84834ec 100644 --- a/lib/private/Collaboration/Reference/RenderReferenceEventListener.php +++ b/lib/private/Collaboration/Reference/RenderReferenceEventListener.php @@ -28,9 +28,6 @@ class RenderReferenceEventListener implements IEventListener { $eventDispatcher->addServiceListener(RenderReferenceEvent::class, RenderReferenceEventListener::class); } - /** - * @inheritDoc - */ public function handle(Event $event): void { if (!($event instanceof RenderReferenceEvent)) { return; diff --git a/lib/private/Collaboration/Resources/Collection.php b/lib/private/Collaboration/Resources/Collection.php index 2c5cc28ef28..21d56f859ca 100644 --- a/lib/private/Collaboration/Resources/Collection.php +++ b/lib/private/Collaboration/Resources/Collection.php @@ -32,23 +32,14 @@ class Collection implements ICollection { ) { } - /** - * @since 16.0.0 - */ public function getId(): int { return $this->id; } - /** - * @since 16.0.0 - */ public function getName(): string { return $this->name; } - /** - * @since 16.0.0 - */ public function setName(string $name): void { $query = $this->connection->getQueryBuilder(); $query->update(Manager::TABLE_COLLECTIONS) @@ -59,10 +50,6 @@ class Collection implements ICollection { $this->name = $name; } - /** - * @return IResource[] - * @since 16.0.0 - */ public function getResources(): array { if (empty($this->resources)) { $this->resources = $this->manager->getResourcesByCollectionForUser($this, $this->userForAccess); @@ -71,12 +58,6 @@ class Collection implements ICollection { return $this->resources; } - /** - * Adds a resource to a collection - * - * @throws ResourceException when the resource is already part of the collection - * @since 16.0.0 - */ public function addResource(IResource $resource): void { array_map(function (IResource $r) use ($resource) { if ($this->isSameResource($r, $resource)) { @@ -103,11 +84,6 @@ class Collection implements ICollection { $this->manager->invalidateAccessCacheForCollection($this); } - /** - * Removes a resource from a collection - * - * @since 16.0.0 - */ public function removeResource(IResource $resource): void { $this->resources = array_filter($this->getResources(), function (IResource $r) use ($resource) { return !$this->isSameResource($r, $resource); @@ -127,11 +103,6 @@ class Collection implements ICollection { } } - /** - * Can a user/guest access the collection - * - * @since 16.0.0 - */ public function canAccess(?IUser $user): bool { if ($user instanceof IUser) { return $this->canUserAccess($user); diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php index 8d1e4b13287..5d7c3ac29a1 100644 --- a/lib/private/Collaboration/Resources/Manager.php +++ b/lib/private/Collaboration/Resources/Manager.php @@ -36,10 +36,6 @@ class Manager implements IManager { ) { } - /** - * @throws CollectionException when the collection could not be found - * @since 16.0.0 - */ public function getCollection(int $id): ICollection { $query = $this->connection->getQueryBuilder(); $query->select('*') @@ -56,10 +52,6 @@ class Manager implements IManager { return new Collection($this, $this->connection, (int)$row['id'], (string)$row['name']); } - /** - * @throws CollectionException when the collection could not be found - * @since 16.0.0 - */ public function getCollectionForUser(int $id, ?IUser $user): ICollection { $query = $this->connection->getQueryBuilder(); $userId = $user instanceof IUser ? $user->getUID() : ''; @@ -137,9 +129,6 @@ class Manager implements IManager { return $collections; } - /** - * @since 16.0.0 - */ public function newCollection(string $name): ICollection { $query = $this->connection->getQueryBuilder(); $query->insert(self::TABLE_COLLECTIONS) @@ -151,17 +140,10 @@ class Manager implements IManager { return new Collection($this, $this->connection, $query->getLastInsertId(), $name); } - /** - * @since 16.0.0 - */ public function createResource(string $type, string $id): IResource { return new Resource($this, $this->connection, $type, $id); } - /** - * @throws ResourceException - * @since 16.0.0 - */ public function getResourceForUser(string $type, string $id, ?IUser $user): IResource { $query = $this->connection->getQueryBuilder(); $userId = $user instanceof IUser ? $user->getUID() : ''; @@ -225,11 +207,6 @@ class Manager implements IManager { return $resources; } - /** - * Get the rich object data of a resource - * - * @since 16.0.0 - */ public function getResourceRichObject(IResource $resource): array { foreach ($this->providerManager->getResourceProviders() as $provider) { if ($provider->getType() === $resource->getType()) { @@ -243,11 +220,6 @@ class Manager implements IManager { return []; } - /** - * Can a user/guest access the collection - * - * @since 16.0.0 - */ public function canAccessResource(IResource $resource, ?IUser $user): bool { $access = $this->checkAccessCacheForUserByResource($resource, $user); if (\is_bool($access)) { @@ -271,11 +243,6 @@ class Manager implements IManager { return $access; } - /** - * Can a user/guest access the collection - * - * @since 16.0.0 - */ public function canAccessCollection(ICollection $collection, ?IUser $user): bool { $access = $this->checkAccessCacheForUserByCollection($collection, $user); if (\is_bool($access)) { @@ -456,11 +423,6 @@ class Manager implements IManager { $this->providerManager->registerResourceProvider($provider); } - /** - * Get the resource type of the provider - * - * @since 16.0.0 - */ public function getType(): string { return ''; } diff --git a/lib/private/Collaboration/Resources/Resource.php b/lib/private/Collaboration/Resources/Resource.php index 34f68aeee11..18f6b58cf45 100644 --- a/lib/private/Collaboration/Resources/Resource.php +++ b/lib/private/Collaboration/Resources/Resource.php @@ -8,7 +8,6 @@ declare(strict_types=1); */ namespace OC\Collaboration\Resources; -use OCP\Collaboration\Resources\ICollection; use OCP\Collaboration\Resources\IManager; use OCP\Collaboration\Resources\IResource; use OCP\IDBConnection; @@ -27,23 +26,14 @@ class Resource implements IResource { ) { } - /** - * @since 16.0.0 - */ public function getType(): string { return $this->type; } - /** - * @since 16.0.0 - */ public function getId(): string { return $this->id; } - /** - * @since 16.0.0 - */ public function getRichObject(): array { if ($this->data === null) { $this->data = $this->manager->getResourceRichObject($this); @@ -52,11 +42,6 @@ class Resource implements IResource { return $this->data; } - /** - * Can a user/guest access the resource - * - * @since 16.0.0 - */ public function canAccess(?IUser $user): bool { if ($user instanceof IUser) { return $this->canUserAccess($user); @@ -88,10 +73,6 @@ class Resource implements IResource { return $access; } - /** - * @return ICollection[] - * @since 16.0.0 - */ public function getCollections(): array { $collections = []; diff --git a/lib/private/Command/AsyncBus.php b/lib/private/Command/AsyncBus.php index fb7860c9dd8..11d78ad7a09 100644 --- a/lib/private/Command/AsyncBus.php +++ b/lib/private/Command/AsyncBus.php @@ -21,11 +21,6 @@ abstract class AsyncBus implements IBus { */ private $syncTraits = []; - /** - * Schedule a command to be fired - * - * @param \OCP\Command\ICommand | callable $command - */ public function push($command) { if ($this->canRunAsync($command)) { $this->queueCommand($command); @@ -41,11 +36,6 @@ abstract class AsyncBus implements IBus { */ abstract protected function queueCommand($command); - /** - * Require all commands using a trait to be run synchronous - * - * @param string $trait - */ public function requireSync($trait) { $this->syncTraits[] = trim($trait, '\\'); } diff --git a/lib/private/Command/QueueBus.php b/lib/private/Command/QueueBus.php index ed7d43b38b6..02d986430a5 100644 --- a/lib/private/Command/QueueBus.php +++ b/lib/private/Command/QueueBus.php @@ -16,20 +16,10 @@ class QueueBus implements IBus { */ private $queue = []; - /** - * Schedule a command to be fired - * - * @param \OCP\Command\ICommand | callable $command - */ public function push($command) { $this->queue[] = $command; } - /** - * Require all commands using a trait to be run synchronous - * - * @param string $trait - */ public function requireSync($trait) { } diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index 3c44c02fe2e..9da0bc6408a 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -43,32 +43,10 @@ class Comment implements IComment { } } - /** - * Returns the ID of the comment - * - * It may return an empty string, if the comment was not stored. - * It is expected that the concrete Comment implementation gives an ID - * by itself (e.g. after saving). - * - * @since 9.0.0 - */ public function getId(): string { return $this->data['id']; } - /** - * Sets the ID of the comment and returns itself - * - * It is only allowed to set the ID only, if the current id is an empty - * string (which means it is not stored in a database, storage or whatever - * the concrete implementation does), or vice versa. Changing a given ID is - * not permitted and must result in an IllegalIDChangeException. - * - * @param string $id - * @return IComment - * @throws IllegalIDChangeException - * @since 9.0.0 - */ public function setId($id): IComment { if (!is_string($id)) { throw new \InvalidArgumentException('String expected.'); @@ -83,21 +61,10 @@ class Comment implements IComment { throw new IllegalIDChangeException('Not allowed to assign a new ID to an already saved comment.'); } - /** - * Returns the parent ID of the comment - * - * @since 9.0.0 - */ public function getParentId(): string { return $this->data['parentId']; } - /** - * Sets the parent ID and returns itself - * - * @param string $parentId - * @since 9.0.0 - */ public function setParentId($parentId): IComment { if (!is_string($parentId)) { throw new \InvalidArgumentException('String expected.'); @@ -106,22 +73,11 @@ class Comment implements IComment { return $this; } - /** - * Returns the topmost parent ID of the comment - * - * @since 9.0.0 - */ public function getTopmostParentId(): string { return $this->data['topmostParentId']; } - /** - * Sets the topmost parent ID and returns itself - * - * @param string $id - * @since 9.0.0 - */ public function setTopmostParentId($id): IComment { if (!is_string($id)) { throw new \InvalidArgumentException('String expected.'); @@ -130,21 +86,10 @@ class Comment implements IComment { return $this; } - /** - * Returns the number of children - * - * @since 9.0.0 - */ public function getChildrenCount(): int { return $this->data['childrenCount']; } - /** - * Sets the number of children - * - * @param int $count - * @since 9.0.0 - */ public function setChildrenCount($count): IComment { if (!is_int($count)) { throw new \InvalidArgumentException('Integer expected.'); @@ -153,22 +98,10 @@ class Comment implements IComment { return $this; } - /** - * Returns the message of the comment - * @since 9.0.0 - */ public function getMessage(): string { return $this->data['message']; } - /** - * sets the message of the comment and returns itself - * - * @param string $message - * @param int $maxLength - * @throws MessageTooLongException - * @since 9.0.0 - */ public function setMessage($message, $maxLength = self::MAX_MESSAGE_LENGTH): IComment { if (!is_string($message)) { throw new \InvalidArgumentException('String expected.'); @@ -181,26 +114,6 @@ class Comment implements IComment { return $this; } - /** - * returns an array containing mentions that are included in the comment - * - * @return array each mention provides a 'type' and an 'id', see example below - * @since 11.0.0 - * - * The return array looks like: - * [ - * [ - * 'type' => 'user', - * 'id' => 'citizen4' - * ], - * [ - * 'type' => 'group', - * 'id' => 'media' - * ], - * … - * ] - * - */ public function getMentions(): array { $ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"guest\/[a-f0-9]+\"|\"(?:federated_)?(?:group|team|user){1}\/[a-z0-9_\-@\.\' \/:]+\"|\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->getMessage(), $mentions); if (!$ok || !isset($mentions[0])) { @@ -234,21 +147,10 @@ class Comment implements IComment { return $result; } - /** - * Returns the verb of the comment - * - * @since 9.0.0 - */ public function getVerb(): string { return $this->data['verb']; } - /** - * Sets the verb of the comment, e.g. 'comment' or 'like' - * - * @param string $verb - * @since 9.0.0 - */ public function setVerb($verb): IComment { if (!is_string($verb) || !trim($verb)) { throw new \InvalidArgumentException('Non-empty String expected.'); @@ -257,29 +159,14 @@ class Comment implements IComment { return $this; } - /** - * Returns the actor type - * @since 9.0.0 - */ public function getActorType(): string { return $this->data['actorType']; } - /** - * Returns the actor ID - * @since 9.0.0 - */ public function getActorId(): string { return $this->data['actorId']; } - /** - * Sets (overwrites) the actor type and id - * - * @param string $actorType e.g. 'users' - * @param string $actorId e.g. 'zombie234' - * @since 9.0.0 - */ public function setActor($actorType, $actorId): IComment { if ( !is_string($actorType) || !trim($actorType) @@ -292,13 +179,6 @@ class Comment implements IComment { return $this; } - /** - * Returns the creation date of the comment. - * - * If not explicitly set, it shall default to the time of initialization. - * @since 9.0.0 - * @throw \LogicException if creation date time is not set yet - */ public function getCreationDateTime(): \DateTime { if (!isset($this->data['creationDT'])) { throw new \LogicException('Cannot get creation date before setting one or writting to database'); @@ -306,54 +186,28 @@ class Comment implements IComment { return $this->data['creationDT']; } - /** - * Sets the creation date of the comment and returns itself - * @since 9.0.0 - */ public function setCreationDateTime(\DateTime $dateTime): IComment { $this->data['creationDT'] = $dateTime; return $this; } - /** - * Returns the DateTime of the most recent child, if set, otherwise null - * @since 9.0.0 - */ public function getLatestChildDateTime(): ?\DateTime { return $this->data['latestChildDT']; } - /** - * @inheritDoc - */ public function setLatestChildDateTime(?\DateTime $dateTime = null): IComment { $this->data['latestChildDT'] = $dateTime; return $this; } - /** - * Returns the object type the comment is attached to - * @since 9.0.0 - */ public function getObjectType(): string { return $this->data['objectType']; } - /** - * Returns the object id the comment is attached to - * @since 9.0.0 - */ public function getObjectId(): string { return $this->data['objectId']; } - /** - * Sets (overwrites) the object of the comment - * - * @param string $objectType e.g. 'files' - * @param string $objectId e.g. '16435' - * @since 9.0.0 - */ public function setObject($objectType, $objectId): IComment { if ( !is_string($objectType) || !trim($objectType) @@ -366,20 +220,10 @@ class Comment implements IComment { return $this; } - /** - * Returns the reference id of the comment - * @since 19.0.0 - */ public function getReferenceId(): ?string { return $this->data['referenceId']; } - /** - * Sets (overwrites) the reference id of the comment - * - * @param string $referenceId e.g. sha256 hash sum - * @since 19.0.0 - */ public function setReferenceId(?string $referenceId): IComment { if ($referenceId === null) { $this->data['referenceId'] = $referenceId; @@ -393,9 +237,6 @@ class Comment implements IComment { return $this; } - /** - * @inheritDoc - */ public function getMetaData(): ?array { if ($this->data['metaData'] === null) { return null; @@ -409,9 +250,6 @@ class Comment implements IComment { return is_array($metaData) ? $metaData : null; } - /** - * @inheritDoc - */ public function setMetaData(?array $metaData): IComment { if ($metaData === null) { $this->data['metaData'] = null; @@ -421,32 +259,20 @@ class Comment implements IComment { return $this; } - /** - * @inheritDoc - */ public function getReactions(): array { return $this->data['reactions'] ?? []; } - /** - * @inheritDoc - */ public function setReactions(?array $reactions): IComment { $this->data['reactions'] = $reactions; return $this; } - /** - * @inheritDoc - */ public function setExpireDate(?\DateTime $dateTime): IComment { $this->data['expire_date'] = $dateTime; return $this; } - /** - * @inheritDoc - */ public function getExpireDate(): ?\DateTime { return $this->data['expire_date']; } diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 8b7f43c03a2..3eeec293421 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -8,7 +8,6 @@ namespace OC\Comments; use Doctrine\DBAL\Exception\DriverException; -use OCA\DAV\Connector\Sabre\File; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Comments\CommentsEvent; use OCP\Comments\IComment; @@ -228,14 +227,6 @@ class Manager implements ICommentsManager { } } - /** - * returns a comment instance - * - * @param string $id the ID of the comment - * @throws NotFoundException - * @throws \InvalidArgumentException - * @since 9.0.0 - */ public function get($id): IComment { if ((int)$id === 0) { throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.'); @@ -264,9 +255,6 @@ class Manager implements ICommentsManager { return $comment; } - /** - * @inheritDoc - */ public function getTree($id, $limit = 0, $offset = 0): array { $tree = []; $tree['comment'] = $this->get($id); @@ -300,21 +288,6 @@ class Manager implements ICommentsManager { return $tree; } - /** - * returns comments for a specific object (e.g. a file). - * - * The sort order is always newest to oldest. - * - * @param string $objectType the object type, e.g. 'files' - * @param string $objectId the id of the object - * @param int $limit optional, number of maximum comments to be returned. if - * not specified, all comments are returned. - * @param int $offset optional, starting point - * @param \DateTime $notOlderThan optional, timestamp of the oldest comments - * that may be returned - * @return list<IComment> - * @since 9.0.0 - */ public function getForObject( $objectType, $objectId, @@ -356,16 +329,6 @@ class Manager implements ICommentsManager { return $comments; } - /** - * @param string $objectType the object type, e.g. 'files' - * @param string $objectId the id of the object - * @param int $lastKnownCommentId the last known comment (will be used as offset) - * @param string $sortDirection direction of the comments (`asc` or `desc`) - * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. - * @param bool $includeLastKnown - * @return list<IComment> - */ public function getForObjectSince( string $objectType, string $objectId, @@ -385,17 +348,6 @@ class Manager implements ICommentsManager { ); } - /** - * @param string $objectType the object type, e.g. 'files' - * @param string $objectId the id of the object - * @param string[] $verbs List of verbs to filter by - * @param int $lastKnownCommentId the last known comment (will be used as offset) - * @param string $sortDirection direction of the comments (`asc` or `desc`) - * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. - * @param bool $includeLastKnown - * @return list<IComment> - */ public function getCommentsWithVerbForObjectSinceComment( string $objectType, string $objectId, @@ -534,17 +486,6 @@ class Manager implements ICommentsManager { return null; } - /** - * Search for comments with a given content - * - * @param string $search content to search for - * @param string $objectType Limit the search by object type - * @param string $objectId Limit the search by object id - * @param string $verb Limit the verb of the comment - * @param int $offset - * @param int $limit - * @return list<IComment> - */ public function search(string $search, string $objectType, string $objectId, string $verb, int $offset, int $limit = 50): array { $objectIds = []; if ($objectId) { @@ -553,17 +494,6 @@ class Manager implements ICommentsManager { return $this->searchForObjects($search, $objectType, $objectIds, $verb, $offset, $limit); } - /** - * Search for comments on one or more objects with a given content - * - * @param string $search content to search for - * @param string $objectType Limit the search by object type - * @param array $objectIds Limit the search by object ids - * @param string $verb Limit the verb of the comment - * @param int $offset - * @param int $limit - * @return list<IComment> - */ public function searchForObjects(string $search, string $objectType, array $objectIds, string $verb, int $offset, int $limit = 50): array { $query = $this->dbConn->getQueryBuilder(); @@ -604,15 +534,6 @@ class Manager implements ICommentsManager { return $comments; } - /** - * @param $objectType string the object type, e.g. 'files' - * @param $objectId string the id of the object - * @param \DateTime $notOlderThan optional, timestamp of the oldest comments - * that may be returned - * @param string $verb Limit the verb of the comment - Added in 14.0.0 - * @return Int - * @since 9.0.0 - */ public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = '') { $qb = $this->dbConn->getQueryBuilder(); $query = $qb->select($qb->func()->count('id')) @@ -638,15 +559,6 @@ class Manager implements ICommentsManager { return (int)$data[0]; } - /** - * @param string $objectType the object type, e.g. 'files' - * @param string[] $objectIds the id of the object - * @param IUser $user - * @param string $verb Limit the verb of the comment - Added in 14.0.0 - * @return array Map with object id => # of unread comments - * @psalm-return array<string, int> - * @since 21.0.0 - */ public function getNumberOfUnreadCommentsForObjects(string $objectType, array $objectIds, IUser $user, $verb = ''): array { $unreadComments = []; $query = $this->dbConn->getQueryBuilder(); @@ -683,14 +595,6 @@ class Manager implements ICommentsManager { return $unreadComments; } - /** - * @param string $objectType - * @param string $objectId - * @param int $lastRead - * @param string $verb - * @return int - * @since 21.0.0 - */ public function getNumberOfCommentsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, string $verb = ''): int { if ($verb !== '') { return $this->getNumberOfCommentsWithVerbsForObjectSinceComment($objectType, $objectId, $lastRead, [$verb]); @@ -699,14 +603,6 @@ class Manager implements ICommentsManager { return $this->getNumberOfCommentsWithVerbsForObjectSinceComment($objectType, $objectId, $lastRead, []); } - /** - * @param string $objectType - * @param string $objectId - * @param int $lastRead - * @param string[] $verbs - * @return int - * @since 24.0.0 - */ public function getNumberOfCommentsWithVerbsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, array $verbs): int { $query = $this->dbConn->getQueryBuilder(); $query->select($query->func()->count('id', 'num_messages')) @@ -726,14 +622,6 @@ class Manager implements ICommentsManager { return (int)($data['num_messages'] ?? 0); } - /** - * @param string $objectType - * @param string $objectId - * @param \DateTime $beforeDate - * @param string $verb - * @return int - * @since 21.0.0 - */ public function getLastCommentBeforeDate(string $objectType, string $objectId, \DateTime $beforeDate, string $verb = ''): int { $query = $this->dbConn->getQueryBuilder(); $query->select('id') @@ -754,16 +642,6 @@ class Manager implements ICommentsManager { return (int)($data['id'] ?? 0); } - /** - * @param string $objectType - * @param string $objectId - * @param string $verb - * @param string $actorType - * @param string[] $actors - * @return \DateTime[] Map of "string actor" => "\DateTime most recent comment date" - * @psalm-return array<string, \DateTime> - * @since 21.0.0 - */ public function getLastCommentDateByActor( string $objectType, string $objectId, @@ -793,15 +671,6 @@ class Manager implements ICommentsManager { return $lastComments; } - /** - * Get the number of unread comments for all files in a folder - * - * This is unused since 8bd39fccf411195839f2dadee085fad18ec52c23 - * - * @param int $folderId - * @param IUser $user - * @return array [$fileId => $unreadCount] - */ public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) { $directory = $this->rootFolder->getFirstNodeById($folderId); if (!$directory instanceof Folder) { @@ -817,18 +686,6 @@ class Manager implements ICommentsManager { }); } - /** - * creates a new comment and returns it. At this point of time, it is not - * saved in the used data storage. Use save() after setting other fields - * of the comment (e.g. message or verb). - * - * @param string $actorType the actor type (e.g. 'users') - * @param string $actorId a user id - * @param string $objectType the object type the comment is attached to - * @param string $objectId the object id the comment is attached to - * @return IComment - * @since 9.0.0 - */ public function create($actorType, $actorId, $objectType, $objectId) { $comment = new Comment(); $comment @@ -837,17 +694,6 @@ class Manager implements ICommentsManager { return $comment; } - /** - * permanently deletes the comment specified by the ID - * - * When the comment has child comments, their parent ID will be changed to - * the parent ID of the item that is to be deleted. - * - * @param string $id - * @return bool - * @throws \InvalidArgumentException - * @since 9.0.0 - */ public function delete($id) { if (!is_string($id)) { throw new \InvalidArgumentException('Parameter must be string'); @@ -895,21 +741,6 @@ class Manager implements ICommentsManager { $this->sumReactions($reaction->getParentId()); } - /** - * Get comment related with user reaction - * - * Throws PreConditionNotMetException when the system haven't the minimum requirements to - * use reactions - * - * @param int $parentId - * @param string $actorType - * @param string $actorId - * @param string $reaction - * @return IComment - * @throws NotFoundException - * @throws PreConditionNotMetException - * @since 24.0.0 - */ public function getReactionComment(int $parentId, string $actorType, string $actorId, string $reaction): IComment { $this->throwIfNotSupportReactions(); $qb = $this->dbConn->getQueryBuilder(); @@ -928,17 +759,6 @@ class Manager implements ICommentsManager { return $this->get($messageId); } - /** - * Retrieve all reactions of a message - * - * Throws PreConditionNotMetException when the system haven't the minimum requirements to - * use reactions - * - * @param int $parentId - * @return IComment[] - * @throws PreConditionNotMetException - * @since 24.0.0 - */ public function retrieveAllReactions(int $parentId): array { $this->throwIfNotSupportReactions(); $qb = $this->dbConn->getQueryBuilder(); @@ -957,18 +777,6 @@ class Manager implements ICommentsManager { return $this->getCommentsById($commentIds); } - /** - * Retrieve all reactions with specific reaction of a message - * - * Throws PreConditionNotMetException when the system haven't the minimum requirements to - * use reactions - * - * @param int $parentId - * @param string $reaction - * @return IComment[] - * @throws PreConditionNotMetException - * @since 24.0.0 - */ public function retrieveAllReactionsWithSpecificReaction(int $parentId, string $reaction): array { $this->throwIfNotSupportReactions(); $qb = $this->dbConn->getQueryBuilder(); @@ -991,12 +799,6 @@ class Manager implements ICommentsManager { return $comments; } - /** - * Support reactions - * - * @return bool - * @since 24.0.0 - */ public function supportReactions(): bool { return $this->emojiHelper->doesPlatformSupportEmoji(); } @@ -1048,26 +850,6 @@ class Manager implements ICommentsManager { return $comments; } - /** - * saves the comment permanently - * - * if the supplied comment has an empty ID, a new entry comment will be - * saved and the instance updated with the new ID. - * - * Otherwise, an existing comment will be updated. - * - * Throws NotFoundException when a comment that is to be updated does not - * exist anymore at this point of time. - * - * Throws PreConditionNotMetException when the system haven't the minimum requirements to - * use reactions - * - * @param IComment $comment - * @return bool - * @throws NotFoundException - * @throws PreConditionNotMetException - * @since 9.0.0 - */ public function save(IComment $comment) { if ($comment->getVerb() === 'reaction') { $this->throwIfNotSupportReactions(); @@ -1257,15 +1039,6 @@ class Manager implements ICommentsManager { return $affectedRows > 0; } - /** - * removes references to specific actor (e.g. on user delete) of a comment. - * The comment itself must not get lost/deleted. - * - * @param string $actorType the actor type (e.g. 'users') - * @param string $actorId a user id - * @return boolean - * @since 9.0.0 - */ public function deleteReferencesOfActor($actorType, $actorId) { $this->checkRoleParameters('Actor', $actorType, $actorId); @@ -1285,14 +1058,6 @@ class Manager implements ICommentsManager { return is_int($affectedRows); } - /** - * deletes all comments made of a specific object (e.g. on file delete) - * - * @param string $objectType the object type (e.g. 'files') - * @param string $objectId e.g. the file id - * @return boolean - * @since 9.0.0 - */ public function deleteCommentsAtObject($objectType, $objectId) { $this->checkRoleParameters('Object', $objectType, $objectId); @@ -1310,13 +1075,6 @@ class Manager implements ICommentsManager { return is_int($affectedRows); } - /** - * deletes the read markers for the specified user - * - * @param \OCP\IUser $user - * @return bool - * @since 9.0.0 - */ public function deleteReadMarksFromUser(IUser $user) { $qb = $this->dbConn->getQueryBuilder(); $query = $qb->delete('comments_read_markers') @@ -1335,16 +1093,6 @@ class Manager implements ICommentsManager { return ($affectedRows > 0); } - /** - * sets the read marker for a given file to the specified date for the - * provided user - * - * @param string $objectType - * @param string $objectId - * @param \DateTime $dateTime - * @param IUser $user - * @since 9.0.0 - */ public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user) { $this->checkRoleParameters('Object', $objectType, $objectId); @@ -1380,17 +1128,6 @@ class Manager implements ICommentsManager { ->execute(); } - /** - * returns the read marker for a given file to the specified date for the - * provided user. It returns null, when the marker is not present, i.e. - * no comments were marked as read. - * - * @param string $objectType - * @param string $objectId - * @param IUser $user - * @return \DateTime|null - * @since 9.0.0 - */ public function getReadMark($objectType, $objectId, IUser $user) { $qb = $this->dbConn->getQueryBuilder(); $resultStatement = $qb->select('marker_datetime') @@ -1412,14 +1149,6 @@ class Manager implements ICommentsManager { return new \DateTime($data['marker_datetime']); } - /** - * deletes the read markers on the specified object - * - * @param string $objectType - * @param string $objectId - * @return bool - * @since 9.0.0 - */ public function deleteReadMarksOnObject($objectType, $objectId) { $this->checkRoleParameters('Object', $objectType, $objectId); @@ -1442,28 +1171,11 @@ class Manager implements ICommentsManager { return ($affectedRows > 0); } - /** - * registers an Entity to the manager, so event notifications can be send - * to consumers of the comments infrastructure - * - * @param \Closure $closure - */ public function registerEventHandler(\Closure $closure) { $this->eventHandlerClosures[] = $closure; $this->eventHandlers = []; } - /** - * registers a method that resolves an ID to a display name for a given type - * - * @param string $type - * @param \Closure $closure - * @throws \OutOfBoundsException - * @since 11.0.0 - * - * Only one resolver shall be registered per type. Otherwise a - * \OutOfBoundsException has to thrown. - */ public function registerDisplayNameResolver($type, \Closure $closure) { if (!is_string($type)) { throw new \InvalidArgumentException('String expected.'); @@ -1474,19 +1186,6 @@ class Manager implements ICommentsManager { $this->displayNameResolvers[$type] = $closure; } - /** - * resolves a given ID of a given Type to a display name. - * - * @param string $type - * @param string $id - * @return string - * @throws \OutOfBoundsException - * @since 11.0.0 - * - * If a provided type was not registered, an \OutOfBoundsException shall - * be thrown. It is upon the resolver discretion what to return of the - * provided ID is unknown. It must be ensured that a string is returned. - */ public function resolveDisplayName($type, $id) { if (!is_string($type)) { throw new \InvalidArgumentException('String expected.'); @@ -1534,19 +1233,11 @@ class Manager implements ICommentsManager { $this->eventDispatcher->dispatchTyped($event); } - /** - * Load the Comments app into the page - * - * @since 21.0.0 - */ public function load(): void { $this->initialStateService->provideInitialState('comments', 'max-message-length', IComment::MAX_MESSAGE_LENGTH); Util::addScript('comments', 'comments-app'); } - /** - * @inheritDoc - */ public function deleteCommentsExpiredAtObject(string $objectType, string $objectId = ''): bool { $qb = $this->dbConn->getQueryBuilder(); $qb->delete('comments') diff --git a/lib/private/Comments/ManagerFactory.php b/lib/private/Comments/ManagerFactory.php index 2436ca74c66..cec653e9703 100644 --- a/lib/private/Comments/ManagerFactory.php +++ b/lib/private/Comments/ManagerFactory.php @@ -7,7 +7,6 @@ */ namespace OC\Comments; -use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManagerFactory; use OCP\IServerContainer; @@ -19,21 +18,10 @@ class ManagerFactory implements ICommentsManagerFactory { */ private $serverContainer; - /** - * Constructor for the comments manager factory - * - * @param IServerContainer $serverContainer server container - */ public function __construct(IServerContainer $serverContainer) { $this->serverContainer = $serverContainer; } - /** - * creates and returns an instance of the ICommentsManager - * - * @return ICommentsManager - * @since 9.0.0 - */ public function getManager() { return $this->serverContainer->get(Manager::class); } diff --git a/lib/private/Contacts/ContactsMenu/ActionFactory.php b/lib/private/Contacts/ContactsMenu/ActionFactory.php index 71ebe575fdd..f053ae64d5f 100644 --- a/lib/private/Contacts/ContactsMenu/ActionFactory.php +++ b/lib/private/Contacts/ContactsMenu/ActionFactory.php @@ -10,9 +10,6 @@ use OCP\Contacts\ContactsMenu\IActionFactory; use OCP\Contacts\ContactsMenu\ILinkAction; class ActionFactory implements IActionFactory { - /** - * {@inheritDoc} - */ public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction { $action = new LinkAction(); $action->setName($name); @@ -22,9 +19,6 @@ class ActionFactory implements IActionFactory { return $action; } - /** - * {@inheritDoc} - */ public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction { return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId); } diff --git a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php index 0d4cc9b9b01..57455d319bf 100644 --- a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php +++ b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php @@ -14,9 +14,6 @@ class LinkAction implements ILinkAction { private int $priority = 10; private string $appId = ''; - /** - * @param string $icon absolute URI to an icon - */ public function setIcon(string $icon): void { $this->icon = $icon; } @@ -45,23 +42,14 @@ class LinkAction implements ILinkAction { return $this->href; } - /** - * @since 23.0.0 - */ public function setAppId(string $appId): void { $this->appId = $appId; } - /** - * @since 23.0.0 - */ public function getAppId(): string { return $this->appId; } - /** - * @return array{title: string, icon: string, hyperlink: string, appId: string} - */ public function jsonSerialize(): array { return [ 'title' => $this->name, diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index d15e6e35706..1843945be05 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -41,9 +41,6 @@ class ContactsStore implements IContactsStore { ) { } - /** - * @return IEntry[] - */ public function getContacts(IUser $user, ?string $filter, ?int $limit = null, ?int $offset = null): array { $options = [ 'enumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes', diff --git a/lib/private/Contacts/ContactsMenu/Entry.php b/lib/private/Contacts/ContactsMenu/Entry.php index d4f2dc7bf90..6b397ee8f69 100644 --- a/lib/private/Contacts/ContactsMenu/Entry.php +++ b/lib/private/Contacts/ContactsMenu/Entry.php @@ -56,9 +56,6 @@ class Entry implements IEntry { $this->emailAddresses[] = $address; } - /** - * @return string[] - */ public function getEMailAddresses(): array { return $this->emailAddresses; } @@ -145,9 +142,6 @@ class Entry implements IEntry { return $this->properties[$key]; } - /** - * @return array{id: int|string|null, fullName: string, avatar: string|null, topAction: mixed, actions: array, lastMessage: '', emailAddresses: string[], profileTitle: string|null, profileUrl: string|null, status: string|null, statusMessage: null|string, statusMessageTimestamp: null|int, statusIcon: null|string, isUser: bool, uid: mixed} - */ public function jsonSerialize(): array { $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null; $otherActions = array_map(function (IAction $action) { diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php index 7dd2bf33124..aac215e098f 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -12,24 +12,6 @@ use OCP\Contacts\IManager; use OCP\IAddressBook; class ContactsManager implements IManager { - /** - * This function is used to search and find contacts within the users address books. - * In case $pattern is empty all contacts will be returned. - * - * @param string $pattern which should match within the $searchProperties - * @param array $searchProperties defines the properties within the query pattern should match - * @param array $options = array() to define the search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed - * - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system address book is allowed - * - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search - * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, enumeration?: bool, fullmatch?: bool, strict_search?: bool} $options - * @return array an array of contacts which are arrays of key-value-pairs - */ public function search($pattern, $searchProperties = [], $options = []) { $this->loadAddressBooks(); $result = []; @@ -67,13 +49,6 @@ class ContactsManager implements IManager { return $result; } - /** - * This function can be used to delete the contact identified by the given id - * - * @param int $id the unique identifier to a contact - * @param string $addressBookKey identifier of the address book in which the contact shall be deleted - * @return bool successful or not - */ public function delete($id, $addressBookKey) { $addressBook = $this->getAddressBook($addressBookKey); if (!$addressBook) { @@ -87,14 +62,6 @@ class ContactsManager implements IManager { return false; } - /** - * This function is used to create a new contact if 'id' is not given or not present. - * Otherwise the contact will be updated by replacing the entire data set. - * - * @param array $properties this array if key-value-pairs defines a contact - * @param string $addressBookKey identifier of the address book in which the contact shall be created or updated - * @return ?array representing the contact just created or updated - */ public function createOrUpdate($properties, $addressBookKey) { $addressBook = $this->getAddressBook($addressBookKey); if (!$addressBook) { @@ -108,43 +75,23 @@ class ContactsManager implements IManager { return null; } - /** - * Check if contacts are available (e.g. contacts app enabled) - * - * @return bool true if enabled, false if not - */ public function isEnabled(): bool { return !empty($this->addressBooks) || !empty($this->addressBookLoaders); } - /** - * @param IAddressBook $addressBook - */ public function registerAddressBook(IAddressBook $addressBook) { $this->addressBooks[$addressBook->getKey()] = $addressBook; } - /** - * @param IAddressBook $addressBook - */ public function unregisterAddressBook(IAddressBook $addressBook) { unset($this->addressBooks[$addressBook->getKey()]); } - /** - * Return a list of the user's addressbooks - * - * @return IAddressBook[] - * @since 16.0.0 - */ public function getUserAddressBooks(): array { $this->loadAddressBooks(); return $this->addressBooks; } - /** - * removes all registered address book instances - */ public function clear() { $this->addressBooks = []; $this->addressBookLoaders = []; @@ -160,12 +107,6 @@ class ContactsManager implements IManager { */ private $addressBookLoaders = []; - /** - * In order to improve lazy loading a closure can be registered which will be called in case - * address books are actually requested - * - * @param \Closure $callable - */ public function register(\Closure $callable) { $this->addressBookLoaders[] = $callable; } diff --git a/lib/private/DB/ConnectionAdapter.php b/lib/private/DB/ConnectionAdapter.php index 2baeda9cfb7..8a12ba4ef79 100644 --- a/lib/private/DB/ConnectionAdapter.php +++ b/lib/private/DB/ConnectionAdapter.php @@ -174,9 +174,6 @@ class ConnectionAdapter implements IDBConnection { return $this->inner->quote($input, $type); } - /** - * @todo we are leaking a 3rdparty type here - */ public function getDatabasePlatform(): AbstractPlatform { return $this->inner->getDatabasePlatform(); } @@ -205,9 +202,6 @@ class ConnectionAdapter implements IDBConnection { return $this->inner->supports4ByteText(); } - /** - * @todo leaks a 3rdparty type - */ public function createSchema(): Schema { try { return $this->inner->createSchema(); @@ -228,9 +222,6 @@ class ConnectionAdapter implements IDBConnection { return $this->inner; } - /** - * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE - */ public function getDatabaseProvider(): string { return $this->inner->getDatabaseProvider(); } diff --git a/lib/private/DB/QueryBuilder/CompositeExpression.php b/lib/private/DB/QueryBuilder/CompositeExpression.php index 6edf385360c..4532314644e 100644 --- a/lib/private/DB/QueryBuilder/CompositeExpression.php +++ b/lib/private/DB/QueryBuilder/CompositeExpression.php @@ -20,13 +20,6 @@ class CompositeExpression implements ICompositeExpression, \Countable { ) { } - /** - * Adds multiple parts to composite expression. - * - * @param array $parts - * - * @return \OCP\DB\QueryBuilder\ICompositeExpression - */ public function addMultiple(array $parts = []): ICompositeExpression { foreach ($parts as $part) { $this->add($part); @@ -35,13 +28,6 @@ class CompositeExpression implements ICompositeExpression, \Countable { return $this; } - /** - * Adds an expression to composite expression. - * - * @param mixed $part - * - * @return \OCP\DB\QueryBuilder\ICompositeExpression - */ public function add($part): ICompositeExpression { if ($part === null) { return $this; @@ -56,20 +42,10 @@ class CompositeExpression implements ICompositeExpression, \Countable { return $this; } - /** - * Retrieves the amount of expressions on composite expression. - * - * @return integer - */ public function count(): int { return count($this->parts); } - /** - * Returns the type of this composite expression (AND/OR). - * - * @return string - */ public function getType(): string { return $this->type; } diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php index b922c861630..1a89165951a 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php @@ -17,7 +17,6 @@ use OC\DB\QueryBuilder\QuoteHelper; use OCP\DB\QueryBuilder\ICompositeExpression; use OCP\DB\QueryBuilder\IExpressionBuilder; use OCP\DB\QueryBuilder\ILiteral; -use OCP\DB\QueryBuilder\IParameter; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryFunction; use OCP\IDBConnection; @@ -47,20 +46,6 @@ class ExpressionBuilder implements IExpressionBuilder { $this->functionBuilder = $queryBuilder->func(); } - /** - * Creates a conjunction of the given boolean expressions. - * - * Example: - * - * [php] - * // (u.type = ?) AND (u.role = ?) - * $expr->andX('u.type = ?', 'u.role = ?')); - * - * @param mixed ...$x Optional clause. Defaults = null, but requires - * at least one defined when converting to string. - * - * @return \OCP\DB\QueryBuilder\ICompositeExpression - */ public function andX(...$x): ICompositeExpression { if (empty($x)) { $this->logger->debug('Calling ' . IQueryBuilder::class . '::' . __FUNCTION__ . ' without parameters is deprecated and will throw soon.', ['exception' => new \Exception('No parameters in call to ' . __METHOD__)]); @@ -68,20 +53,6 @@ class ExpressionBuilder implements IExpressionBuilder { return new CompositeExpression(CompositeExpression::TYPE_AND, $x); } - /** - * Creates a disjunction of the given boolean expressions. - * - * Example: - * - * [php] - * // (u.type = ?) OR (u.role = ?) - * $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?')); - * - * @param mixed ...$x Optional clause. Defaults = null, but requires - * at least one defined when converting to string. - * - * @return \OCP\DB\QueryBuilder\ICompositeExpression - */ public function orX(...$x): ICompositeExpression { if (empty($x)) { $this->logger->debug('Calling ' . IQueryBuilder::class . '::' . __FUNCTION__ . ' without parameters is deprecated and will throw soon.', ['exception' => new \Exception('No parameters in call to ' . __METHOD__)]); @@ -89,289 +60,94 @@ class ExpressionBuilder implements IExpressionBuilder { return new CompositeExpression(CompositeExpression::TYPE_OR, $x); } - /** - * Creates a comparison expression. - * - * @param mixed $x The left expression. - * @param string $operator One of the IExpressionBuilder::* constants. - * @param mixed $y The right expression. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function comparison($x, string $operator, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); return $this->expressionBuilder->comparison($x, $operator, $y); } - /** - * Creates an equality comparison expression with the given arguments. - * - * First argument is considered the left expression and the second is the right expression. - * When converted to string, it will generated a <left expr> = <right expr>. Example: - * - * [php] - * // u.id = ? - * $expr->eq('u.id', '?'); - * - * @param mixed $x The left expression. - * @param mixed $y The right expression. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function eq($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); return $this->expressionBuilder->eq($x, $y); } - /** - * Creates a non equality comparison expression with the given arguments. - * First argument is considered the left expression and the second is the right expression. - * When converted to string, it will generated a <left expr> <> <right expr>. Example: - * - * [php] - * // u.id <> 1 - * $q->where($q->expr()->neq('u.id', '1')); - * - * @param mixed $x The left expression. - * @param mixed $y The right expression. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function neq($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); return $this->expressionBuilder->neq($x, $y); } - /** - * Creates a lower-than comparison expression with the given arguments. - * First argument is considered the left expression and the second is the right expression. - * When converted to string, it will generated a <left expr> < <right expr>. Example: - * - * [php] - * // u.id < ? - * $q->where($q->expr()->lt('u.id', '?')); - * - * @param mixed $x The left expression. - * @param mixed $y The right expression. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function lt($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); return $this->expressionBuilder->lt($x, $y); } - /** - * Creates a lower-than-equal comparison expression with the given arguments. - * First argument is considered the left expression and the second is the right expression. - * When converted to string, it will generated a <left expr> <= <right expr>. Example: - * - * [php] - * // u.id <= ? - * $q->where($q->expr()->lte('u.id', '?')); - * - * @param mixed $x The left expression. - * @param mixed $y The right expression. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function lte($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); return $this->expressionBuilder->lte($x, $y); } - /** - * Creates a greater-than comparison expression with the given arguments. - * First argument is considered the left expression and the second is the right expression. - * When converted to string, it will generated a <left expr> > <right expr>. Example: - * - * [php] - * // u.id > ? - * $q->where($q->expr()->gt('u.id', '?')); - * - * @param mixed $x The left expression. - * @param mixed $y The right expression. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function gt($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); return $this->expressionBuilder->gt($x, $y); } - /** - * Creates a greater-than-equal comparison expression with the given arguments. - * First argument is considered the left expression and the second is the right expression. - * When converted to string, it will generated a <left expr> >= <right expr>. Example: - * - * [php] - * // u.id >= ? - * $q->where($q->expr()->gte('u.id', '?')); - * - * @param mixed $x The left expression. - * @param mixed $y The right expression. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function gte($x, $y, $type = null): string { $x = $this->prepareColumn($x, $type); $y = $this->prepareColumn($y, $type); return $this->expressionBuilder->gte($x, $y); } - /** - * Creates an IS NULL expression with the given arguments. - * - * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NULL. - * - * @return string - */ public function isNull($x): string { $x = $this->helper->quoteColumnName($x); return $this->expressionBuilder->isNull($x); } - /** - * Creates an IS NOT NULL expression with the given arguments. - * - * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NOT NULL. - * - * @return string - */ public function isNotNull($x): string { $x = $this->helper->quoteColumnName($x); return $this->expressionBuilder->isNotNull($x); } - /** - * Creates a LIKE() comparison expression with the given arguments. - * - * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison. - * @param mixed $y Argument to be used in LIKE() comparison. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function like($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); return $this->expressionBuilder->like($x, $y); } - /** - * Creates a ILIKE() comparison expression with the given arguments. - * - * @param string $x Field in string format to be inspected by ILIKE() comparison. - * @param mixed $y Argument to be used in ILIKE() comparison. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - * @since 9.0.0 - */ public function iLike($x, $y, $type = null): string { return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); } - /** - * Creates a NOT LIKE() comparison expression with the given arguments. - * - * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison. - * @param mixed $y Argument to be used in NOT LIKE() comparison. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function notLike($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); return $this->expressionBuilder->notLike($x, $y); } - /** - * Creates a IN () comparison expression with the given arguments. - * - * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison. - * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function in($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnNames($y); return $this->expressionBuilder->in($x, $y); } - /** - * Creates a NOT IN () comparison expression with the given arguments. - * - * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison. - * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison. - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility - * - * @return string - */ public function notIn($x, $y, $type = null): string { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnNames($y); return $this->expressionBuilder->notIn($x, $y); } - /** - * Creates a $x = '' statement, because Oracle needs a different check - * - * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. - * @return string - * @since 13.0.0 - */ public function emptyString($x): string { return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR)); } - /** - * Creates a `$x <> ''` statement, because Oracle needs a different check - * - * @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. - * @return string - * @since 13.0.0 - */ public function nonEmptyString($x): string { return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR)); } - /** - * Binary AND Operator copies a bit to the result if it exists in both operands. - * - * @param string|ILiteral $x The field or value to check - * @param int $y Bitmap that must be set - * @return IQueryFunction - * @since 12.0.0 - */ public function bitwiseAnd($x, int $y): IQueryFunction { return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression( $this->helper->quoteColumnName($x), @@ -379,14 +155,6 @@ class ExpressionBuilder implements IExpressionBuilder { )); } - /** - * Binary OR Operator copies a bit if it exists in either operand. - * - * @param string|ILiteral $x The field or value to check - * @param int $y Bitmap that must be set - * @return IQueryFunction - * @since 12.0.0 - */ public function bitwiseOr($x, int $y): IQueryFunction { return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression( $this->helper->quoteColumnName($x), @@ -394,26 +162,10 @@ class ExpressionBuilder implements IExpressionBuilder { )); } - /** - * Quotes a given input parameter. - * - * @param mixed $input The parameter to be quoted. - * @param int $type One of the IQueryBuilder::PARAM_* constants - * - * @return ILiteral - */ public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral { return new Literal($this->expressionBuilder->literal($input, $type)); } - /** - * Returns a IQueryFunction that casts the column to the given type - * - * @param string|IQueryFunction $column - * @param mixed $type One of IQueryBuilder::PARAM_* - * @psalm-param IQueryBuilder::PARAM_* $type - * @return IQueryFunction - */ public function castColumn($column, $type): IQueryFunction { return new QueryFunction( $this->helper->quoteColumnName($column) diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index 5c7e273c9ec..4c1fc69e0ad 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -20,9 +20,6 @@ use OC\DB\QueryBuilder\FunctionBuilder\PgSqlFunctionBuilder; use OC\DB\QueryBuilder\FunctionBuilder\SqliteFunctionBuilder; use OC\SystemConfig; use OCP\DB\IResult; -use OCP\DB\QueryBuilder\ICompositeExpression; -use OCP\DB\QueryBuilder\ILiteral; -use OCP\DB\QueryBuilder\IParameter; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryFunction; use OCP\IDBConnection; @@ -65,33 +62,10 @@ class QueryBuilder implements IQueryBuilder { $this->helper = new QuoteHelper(); } - /** - * Enable/disable automatic prefixing of table names with the oc_ prefix - * - * @param bool $enabled If set to true table names will be prefixed with the - * owncloud database prefix automatically. - * @since 8.2.0 - */ public function automaticTablePrefix($enabled) { $this->automaticTablePrefix = (bool)$enabled; } - /** - * Gets an ExpressionBuilder used for object-oriented construction of query expressions. - * This producer method is intended for convenient inline usage. Example: - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u') - * ->from('users', 'u') - * ->where($qb->expr()->eq('u.id', 1)); - * </code> - * - * For more complex expression construction, consider storing the expression - * builder object in a local variable. - * - * @return \OCP\DB\QueryBuilder\IExpressionBuilder - */ public function expr() { return match($this->connection->getDatabaseProvider()) { IDBConnection::PLATFORM_ORACLE => new OCIExpressionBuilder($this->connection, $this, $this->logger), @@ -101,22 +75,6 @@ class QueryBuilder implements IQueryBuilder { }; } - /** - * Gets an FunctionBuilder used for object-oriented construction of query functions. - * This producer method is intended for convenient inline usage. Example: - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u') - * ->from('users', 'u') - * ->where($qb->fun()->md5('u.id')); - * </code> - * - * For more complex function construction, consider storing the function - * builder object in a local variable. - * - * @return \OCP\DB\QueryBuilder\IFunctionBuilder - */ public function func() { return match($this->connection->getDatabaseProvider()) { IDBConnection::PLATFORM_ORACLE => new OCIFunctionBuilder($this->connection, $this, $this->helper), @@ -126,31 +84,14 @@ class QueryBuilder implements IQueryBuilder { }; } - /** - * Gets the type of the currently built query. - * - * @return integer - */ public function getType() { return $this->queryBuilder->getType(); } - /** - * Gets the associated DBAL Connection for this query builder. - * - * @return \OCP\IDBConnection - */ public function getConnection() { return $this->connection; } - /** - * Gets the state of this query builder instance. - * - * @return int Always returns 0 which is former `QueryBuilder::STATE_DIRTY` - * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update - * and we can not fix this in our wrapper. - */ public function getState() { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); return $this->queryBuilder->getState(); @@ -235,14 +176,6 @@ class QueryBuilder implements IQueryBuilder { } } - /** - * Executes this query using the bound parameters and their types. - * - * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate} - * for insert, update and delete statements. - * - * @return IResult|int - */ public function execute(?IDBConnection $connection = null) { try { if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::SELECT) { @@ -294,144 +227,48 @@ class QueryBuilder implements IQueryBuilder { } - /** - * Gets the complete SQL string formed by the current specifications of this QueryBuilder. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u') - * ->from('User', 'u') - * echo $qb->getSQL(); // SELECT u FROM User u - * </code> - * - * @return string The SQL query string. - */ public function getSQL() { return $this->queryBuilder->getSQL(); } - /** - * Sets a query parameter for the query being constructed. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u') - * ->from('users', 'u') - * ->where('u.id = :user_id') - * ->setParameter(':user_id', 1); - * </code> - * - * @param string|integer $key The parameter position or name. - * @param mixed $value The parameter value. - * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants. - * - * @return $this This QueryBuilder instance. - */ public function setParameter($key, $value, $type = null) { $this->queryBuilder->setParameter($key, $value, $type); return $this; } - /** - * Sets a collection of query parameters for the query being constructed. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u') - * ->from('users', 'u') - * ->where('u.id = :user_id1 OR u.id = :user_id2') - * ->setParameters(array( - * ':user_id1' => 1, - * ':user_id2' => 2 - * )); - * </code> - * - * @param array $params The query parameters to set. - * @param array $types The query parameters types to set. - * - * @return $this This QueryBuilder instance. - */ public function setParameters(array $params, array $types = []) { $this->queryBuilder->setParameters($params, $types); return $this; } - /** - * Gets all defined query parameters for the query being constructed indexed by parameter index or name. - * - * @return array The currently defined query parameters indexed by parameter index or name. - */ public function getParameters() { return $this->queryBuilder->getParameters(); } - /** - * Gets a (previously set) query parameter of the query being constructed. - * - * @param mixed $key The key (index or name) of the bound parameter. - * - * @return mixed The value of the bound parameter. - */ public function getParameter($key) { return $this->queryBuilder->getParameter($key); } - /** - * Gets all defined query parameter types for the query being constructed indexed by parameter index or name. - * - * @return array The currently defined query parameter types indexed by parameter index or name. - */ public function getParameterTypes() { return $this->queryBuilder->getParameterTypes(); } - /** - * Gets a (previously set) query parameter type of the query being constructed. - * - * @param mixed $key The key (index or name) of the bound parameter type. - * - * @return mixed The value of the bound parameter type. - */ public function getParameterType($key) { return $this->queryBuilder->getParameterType($key); } - /** - * Sets the position of the first result to retrieve (the "offset"). - * - * @param int $firstResult The first result to return. - * - * @return $this This QueryBuilder instance. - */ public function setFirstResult($firstResult) { $this->queryBuilder->setFirstResult((int)$firstResult); return $this; } - /** - * Gets the position of the first result the query object was set to retrieve (the "offset"). - * Returns 0 if {@link setFirstResult} was not applied to this QueryBuilder. - * - * @return int The position of the first result. - */ public function getFirstResult() { return $this->queryBuilder->getFirstResult(); } - /** - * Sets the maximum number of results to retrieve (the "limit"). - * - * NOTE: Setting max results to "0" will cause mixed behaviour. While most - * of the databases will just return an empty result set, Oracle will return - * all entries. - * - * @param int|null $maxResults The maximum number of results to retrieve. - * - * @return $this This QueryBuilder instance. - */ public function setMaxResults($maxResults) { if ($maxResults === null) { $this->queryBuilder->setMaxResults($maxResults); @@ -442,31 +279,10 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Gets the maximum number of results the query object was set to retrieve (the "limit"). - * Returns NULL if {@link setMaxResults} was not applied to this query builder. - * - * @return int|null The maximum number of results. - */ public function getMaxResults() { return $this->queryBuilder->getMaxResults(); } - /** - * Specifies an item that is to be returned in the query result. - * Replaces any previously specified selections, if any. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.id', 'p.id') - * ->from('users', 'u') - * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); - * </code> - * - * @param mixed ...$selects The selection expressions. - * - * '@return $this This QueryBuilder instance. - */ public function select(...$selects) { if (count($selects) === 1 && is_array($selects[0])) { $selects = $selects[0]; @@ -480,21 +296,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Specifies an item that is to be returned with a different name in the query result. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->selectAlias('u.id', 'user_id') - * ->from('users', 'u') - * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id'); - * </code> - * - * @param mixed $select The selection expressions. - * @param string $alias The column alias used in the constructed query. - * - * @return $this This QueryBuilder instance. - */ public function selectAlias($select, $alias) { $this->queryBuilder->addSelect( $this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias) @@ -504,19 +305,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Specifies an item that is to be returned uniquely in the query result. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->selectDistinct('type') - * ->from('users'); - * </code> - * - * @param mixed $select The selection expressions. - * - * @return $this This QueryBuilder instance. - */ public function selectDistinct($select) { if (!is_array($select)) { $select = [$select]; @@ -532,21 +320,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Adds an item that is to be returned in the query result. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.id') - * ->addSelect('p.id') - * ->from('users', 'u') - * ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id'); - * </code> - * - * @param mixed ...$selects The selection expression. - * - * @return $this This QueryBuilder instance. - */ public function addSelect(...$selects) { if (count($selects) === 1 && is_array($selects[0])) { $selects = $selects[0]; @@ -584,23 +357,6 @@ class QueryBuilder implements IQueryBuilder { }, $this->selectedColumns)); } - /** - * Turns the query being built into a bulk delete query that ranges over - * a certain table. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->delete('users', 'u') - * ->where('u.id = :user_id'); - * ->setParameter(':user_id', 1); - * </code> - * - * @param string $delete The table whose rows are subject to the deletion. - * @param string $alias The table alias used in the constructed query. - * - * @return $this This QueryBuilder instance. - * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update - */ public function delete($delete = null, $alias = null) { if ($alias !== null) { $this->logger->debug('DELETE queries with alias are no longer supported and the provided alias is ignored', ['exception' => new \InvalidArgumentException('Table alias provided for DELETE query')]); @@ -614,23 +370,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Turns the query being built into a bulk update query that ranges over - * a certain table - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->update('users', 'u') - * ->set('u.password', md5('password')) - * ->where('u.id = ?'); - * </code> - * - * @param string $update The table whose rows are subject to the update. - * @param string $alias The table alias used in the constructed query. - * - * @return $this This QueryBuilder instance. - * @since 30.0.0 Alias is deprecated and will no longer be used with the next Doctrine/DBAL update - */ public function update($update = null, $alias = null) { if ($alias !== null) { $this->logger->debug('UPDATE queries with alias are no longer supported and the provided alias is ignored', ['exception' => new \InvalidArgumentException('Table alias provided for UPDATE query')]); @@ -644,25 +383,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Turns the query being built into an insert query that inserts into - * a certain table - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->insert('users') - * ->values( - * array( - * 'name' => '?', - * 'password' => '?' - * ) - * ); - * </code> - * - * @param string $insert The table into which the rows should be inserted. - * - * @return $this This QueryBuilder instance. - */ public function insert($insert = null) { $this->queryBuilder->insert( $this->getTableName($insert) @@ -673,21 +393,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Creates and adds a query root corresponding to the table identified by the - * given alias, forming a cartesian product with any existing query roots. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.id') - * ->from('users', 'u') - * </code> - * - * @param string|IQueryFunction $from The table. - * @param string|null $alias The alias of the table. - * - * @return $this This QueryBuilder instance. - */ public function from($from, $alias = null) { $this->queryBuilder->from( $this->getTableName($from), @@ -697,23 +402,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Creates and adds a join to the query. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1'); - * </code> - * - * @param string $fromAlias The alias that points to a from clause. - * @param string $join The table name to join. - * @param string $alias The alias of the join table. - * @param string|ICompositeExpression|null $condition The condition for the join. - * - * @return $this This QueryBuilder instance. - */ public function join($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->join( $this->quoteAlias($fromAlias), @@ -725,23 +413,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Creates and adds a join to the query. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); - * </code> - * - * @param string $fromAlias The alias that points to a from clause. - * @param string $join The table name to join. - * @param string $alias The alias of the join table. - * @param string|ICompositeExpression|null $condition The condition for the join. - * - * @return $this This QueryBuilder instance. - */ public function innerJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->innerJoin( $this->quoteAlias($fromAlias), @@ -753,23 +424,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Creates and adds a left join to the query. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); - * </code> - * - * @param string $fromAlias The alias that points to a from clause. - * @param string $join The table name to join. - * @param string $alias The alias of the join table. - * @param string|ICompositeExpression|null $condition The condition for the join. - * - * @return $this This QueryBuilder instance. - */ public function leftJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->leftJoin( $this->quoteAlias($fromAlias), @@ -781,23 +435,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Creates and adds a right join to the query. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); - * </code> - * - * @param string $fromAlias The alias that points to a from clause. - * @param string $join The table name to join. - * @param string $alias The alias of the join table. - * @param string|ICompositeExpression|null $condition The condition for the join. - * - * @return $this This QueryBuilder instance. - */ public function rightJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->rightJoin( $this->quoteAlias($fromAlias), @@ -809,21 +446,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Sets a new value for a column in a bulk update query. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->update('users', 'u') - * ->set('u.password', md5('password')) - * ->where('u.id = ?'); - * </code> - * - * @param string $key The column to set. - * @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc. - * - * @return $this This QueryBuilder instance. - */ public function set($key, $value) { $this->queryBuilder->set( $this->helper->quoteColumnName($key), @@ -833,33 +455,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Specifies one or more restrictions to the query result. - * Replaces any previously specified restrictions, if any. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->where('u.id = ?'); - * - * // You can optionally programmatically build and/or expressions - * $qb = $conn->getQueryBuilder(); - * - * $or = $qb->expr()->orx( - * $qb->expr()->eq('u.id', 1), - * $qb->expr()->eq('u.id', 2), - * ); - * - * $qb->update('users', 'u') - * ->set('u.password', md5('password')) - * ->where($or); - * </code> - * - * @param mixed ...$predicates The restriction predicates. - * - * @return $this This QueryBuilder instance. - */ public function where(...$predicates) { if ($this->nonEmptyWhere && $this->systemConfig->getValue('debug', false)) { // Only logging a warning, not throwing for now. @@ -877,24 +472,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Adds one or more restrictions to the query results, forming a logical - * conjunction with any previously specified restrictions. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u') - * ->from('users', 'u') - * ->where('u.username LIKE ?') - * ->andWhere('u.is_active = 1'); - * </code> - * - * @param mixed ...$where The query restrictions. - * - * @return $this This QueryBuilder instance. - * - * @see where() - */ public function andWhere(...$where) { $this->nonEmptyWhere = true; call_user_func_array( @@ -905,24 +482,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Adds one or more restrictions to the query results, forming a logical - * disjunction with any previously specified restrictions. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->where('u.id = 1') - * ->orWhere('u.id = 2'); - * </code> - * - * @param mixed ...$where The WHERE statement. - * - * @return $this This QueryBuilder instance. - * - * @see where() - */ public function orWhere(...$where) { $this->nonEmptyWhere = true; call_user_func_array( @@ -933,21 +492,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Specifies a grouping over the results of the query. - * Replaces any previously specified groupings, if any. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->groupBy('u.id'); - * </code> - * - * @param mixed ...$groupBys The grouping expression. - * - * @return $this This QueryBuilder instance. - */ public function groupBy(...$groupBys) { if (count($groupBys) === 1 && is_array($groupBys[0])) { $groupBys = $groupBys[0]; @@ -961,21 +505,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Adds a grouping expression to the query. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->select('u.name') - * ->from('users', 'u') - * ->groupBy('u.lastLogin'); - * ->addGroupBy('u.createdAt') - * </code> - * - * @param mixed ...$groupBy The grouping expression. - * - * @return $this This QueryBuilder instance. - */ public function addGroupBy(...$groupBy) { call_user_func_array( [$this->queryBuilder, 'addGroupBy'], @@ -985,25 +514,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Sets a value for a column in an insert query. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->insert('users') - * ->values( - * array( - * 'name' => '?' - * ) - * ) - * ->setValue('password', '?'); - * </code> - * - * @param string $column The column into which the value should be inserted. - * @param IParameter|string $value The value that should be inserted into the column. - * - * @return $this This QueryBuilder instance. - */ public function setValue($column, $value) { $this->queryBuilder->setValue( $this->helper->quoteColumnName($column), @@ -1013,25 +523,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Specifies values for an insert query indexed by column names. - * Replaces any previous values, if any. - * - * <code> - * $qb = $conn->getQueryBuilder() - * ->insert('users') - * ->values( - * array( - * 'name' => '?', - * 'password' => '?' - * ) - * ); - * </code> - * - * @param array $values The values to specify for the insert query indexed by column names. - * - * @return $this This QueryBuilder instance. - */ public function values(array $values) { $quotedValues = []; foreach ($values as $key => $value) { @@ -1043,14 +534,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Specifies a restriction over the groups of the query. - * Replaces any previous having restrictions, if any. - * - * @param mixed ...$having The restriction over the groups. - * - * @return $this This QueryBuilder instance. - */ public function having(...$having) { call_user_func_array( [$this->queryBuilder, 'having'], @@ -1060,14 +543,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Adds a restriction over the groups of the query, forming a logical - * conjunction with any existing having restrictions. - * - * @param mixed ...$having The restriction to append. - * - * @return $this This QueryBuilder instance. - */ public function andHaving(...$having) { call_user_func_array( [$this->queryBuilder, 'andHaving'], @@ -1077,14 +552,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Adds a restriction over the groups of the query, forming a logical - * disjunction with any existing having restrictions. - * - * @param mixed ...$having The restriction to add. - * - * @return $this This QueryBuilder instance. - */ public function orHaving(...$having) { call_user_func_array( [$this->queryBuilder, 'orHaving'], @@ -1094,15 +561,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Specifies an ordering for the query results. - * Replaces any previously specified orderings, if any. - * - * @param string|IQueryFunction|ILiteral|IParameter $sort The ordering expression. - * @param string $order The ordering direction. - * - * @return $this This QueryBuilder instance. - */ public function orderBy($sort, $order = null) { $this->queryBuilder->orderBy( $this->helper->quoteColumnName($sort), @@ -1112,14 +570,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Adds an ordering to the query results. - * - * @param string|ILiteral|IParameter|IQueryFunction $sort The ordering expression. - * @param string $order The ordering direction. - * - * @return $this This QueryBuilder instance. - */ public function addOrderBy($sort, $order = null) { $this->queryBuilder->addOrderBy( $this->helper->quoteColumnName($sort), @@ -1129,41 +579,16 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Gets a query part by its name. - * - * @param string $queryPartName - * - * @return mixed - * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update - * and we can not fix this in our wrapper. Please track the details you need, outside the object. - */ public function getQueryPart($queryPartName) { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); return $this->queryBuilder->getQueryPart($queryPartName); } - /** - * Gets all query parts. - * - * @return array - * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update - * and we can not fix this in our wrapper. Please track the details you need, outside the object. - */ public function getQueryParts() { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); return $this->queryBuilder->getQueryParts(); } - /** - * Resets SQL parts. - * - * @param array|null $queryPartNames - * - * @return $this This QueryBuilder instance. - * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update - * and we can not fix this in our wrapper. Please create a new IQueryBuilder instead. - */ public function resetQueryParts($queryPartNames = null) { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); $this->queryBuilder->resetQueryParts($queryPartNames); @@ -1171,15 +596,6 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Resets a single SQL part. - * - * @param string $queryPartName - * - * @return $this This QueryBuilder instance. - * @deprecated 30.0.0 This function is going to be removed with the next Doctrine/DBAL update - * and we can not fix this in our wrapper. Please create a new IQueryBuilder instead. - */ public function resetQueryPart($queryPartName) { $this->logger->debug(IQueryBuilder::class . '::' . __FUNCTION__ . ' is deprecated and will be removed soon.', ['exception' => new \Exception('Deprecated call to ' . __METHOD__)]); $this->queryBuilder->resetQueryPart($queryPartName); @@ -1187,117 +603,22 @@ class QueryBuilder implements IQueryBuilder { return $this; } - /** - * Creates a new named parameter and bind the value $value to it. - * - * This method provides a shortcut for PDOStatement::bindValue - * when using prepared statements. - * - * The parameter $value specifies the value that you want to bind. If - * $placeholder is not provided bindValue() will automatically create a - * placeholder for you. An automatic placeholder will be of the name - * ':dcValue1', ':dcValue2' etc. - * - * For more information see {@link https://www.php.net/pdostatement-bindparam} - * - * Example: - * <code> - * $value = 2; - * $q->eq( 'id', $q->bindValue( $value ) ); - * $stmt = $q->executeQuery(); // executed with 'id = 2' - * </code> - * - * @license New BSD License - * @link http://www.zetacomponents.org - * - * @param mixed $value - * @param IQueryBuilder::PARAM_* $type - * @param string $placeHolder The name to bind with. The string must start with a colon ':'. - * - * @return IParameter the placeholder name used. - */ public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) { return new Parameter($this->queryBuilder->createNamedParameter($value, $type, $placeHolder)); } - /** - * Creates a new positional parameter and bind the given value to it. - * - * Attention: If you are using positional parameters with the query builder you have - * to be very careful to bind all parameters in the order they appear in the SQL - * statement , otherwise they get bound in the wrong order which can lead to serious - * bugs in your code. - * - * Example: - * <code> - * $qb = $conn->getQueryBuilder(); - * $qb->select('u.*') - * ->from('users', 'u') - * ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR)) - * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR)) - * </code> - * - * @param mixed $value - * @param IQueryBuilder::PARAM_* $type - * - * @return IParameter - */ public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) { return new Parameter($this->queryBuilder->createPositionalParameter($value, $type)); } - /** - * Creates a new parameter - * - * Example: - * <code> - * $qb = $conn->getQueryBuilder(); - * $qb->select('u.*') - * ->from('users', 'u') - * ->where('u.username = ' . $qb->createParameter('name')) - * ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR)) - * </code> - * - * @param string $name - * - * @return IParameter - */ public function createParameter($name) { return new Parameter(':' . $name); } - /** - * Creates a new function - * - * Attention: Column names inside the call have to be quoted before hand - * - * Example: - * <code> - * $qb = $conn->getQueryBuilder(); - * $qb->select($qb->createFunction('COUNT(*)')) - * ->from('users', 'u') - * echo $qb->getSQL(); // SELECT COUNT(*) FROM `users` u - * </code> - * <code> - * $qb = $conn->getQueryBuilder(); - * $qb->select($qb->createFunction('COUNT(`column`)')) - * ->from('users', 'u') - * echo $qb->getSQL(); // SELECT COUNT(`column`) FROM `users` u - * </code> - * - * @param string $call - * - * @return IQueryFunction - */ public function createFunction($call) { return new QueryFunction($call); } - /** - * Used to get the id of the last inserted element - * @return int - * @throws \BadMethodCallException When being called before an insert query has been run. - */ public function getLastInsertId(): int { if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) { // lastInsertId() needs the prefix but no quotes @@ -1308,12 +629,6 @@ class QueryBuilder implements IQueryBuilder { throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.'); } - /** - * Returns the table name quoted and with database prefix as needed by the implementation - * - * @param string|IQueryFunction $table - * @return string - */ public function getTableName($table) { if ($table instanceof IQueryFunction) { return (string)$table; @@ -1323,12 +638,6 @@ class QueryBuilder implements IQueryBuilder { return $this->helper->quoteColumnName($table); } - /** - * Returns the table name with database prefix as needed by the implementation - * - * @param string $table - * @return string - */ public function prefixTableName(string $table): string { if ($this->automaticTablePrefix === false || str_starts_with($table, '*PREFIX*')) { return $table; @@ -1337,13 +646,6 @@ class QueryBuilder implements IQueryBuilder { return '*PREFIX*' . $table; } - /** - * Returns the column name quoted and with table alias prefix as needed by the implementation - * - * @param string $column - * @param string $tableAlias - * @return string - */ public function getColumnName($column, $tableAlias = '') { if ($tableAlias !== '') { $tableAlias .= '.'; diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php index 473c0009237..73bc2146cf7 100644 --- a/lib/private/DB/SchemaWrapper.php +++ b/lib/private/DB/SchemaWrapper.php @@ -5,8 +5,6 @@ */ namespace OC\DB; -use Doctrine\DBAL\Exception; -use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\Schema; use OCP\DB\ISchemaWrapper; @@ -43,11 +41,6 @@ class SchemaWrapper implements ISchemaWrapper { } } - /** - * Gets all table names - * - * @return array - */ public function getTableNamesWithoutPrefix() { $tableNames = $this->schema->getTableNames(); return array_map(function ($tableName) { @@ -59,74 +52,32 @@ class SchemaWrapper implements ISchemaWrapper { }, $tableNames); } - // Overwritten methods - - /** - * @return array - */ public function getTableNames() { return $this->schema->getTableNames(); } - /** - * @param string $tableName - * - * @return \Doctrine\DBAL\Schema\Table - * @throws \Doctrine\DBAL\Schema\SchemaException - */ public function getTable($tableName) { return $this->schema->getTable($this->connection->getPrefix() . $tableName); } - /** - * Does this schema have a table with the given name? - * - * @param string $tableName - * - * @return boolean - */ public function hasTable($tableName) { return $this->schema->hasTable($this->connection->getPrefix() . $tableName); } - /** - * Creates a new table. - * - * @param string $tableName - * @return \Doctrine\DBAL\Schema\Table - */ public function createTable($tableName) { unset($this->tablesToDelete[$tableName]); return $this->schema->createTable($this->connection->getPrefix() . $tableName); } - /** - * Drops a table from the schema. - * - * @param string $tableName - * @return \Doctrine\DBAL\Schema\Schema - */ public function dropTable($tableName) { $this->tablesToDelete[$tableName] = true; return $this->schema->dropTable($this->connection->getPrefix() . $tableName); } - /** - * Gets all tables of this schema. - * - * @return \Doctrine\DBAL\Schema\Table[] - */ public function getTables() { return $this->schema->getTables(); } - /** - * Gets the DatabasePlatform for the database. - * - * @return AbstractPlatform - * - * @throws Exception - */ public function getDatabasePlatform() { return $this->connection->getDatabasePlatform(); } diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index d4a9eb189ff..d1717dbcd68 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -121,9 +121,6 @@ class Manager implements IManager { $this->lazyWidgets = []; } - /** - * @return array<string, IWidget> - */ public function getWidgets(): array { $this->loadLazyPanels(); return $this->widgets; diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php index 2882a7d8cd7..a3cea7f726f 100644 --- a/lib/private/DateTimeFormatter.php +++ b/lib/private/DateTimeFormatter.php @@ -74,39 +74,10 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { return $timestamp; } - /** - * Formats the date of the given timestamp - * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' - * long: e.g. 'MMMM d, y' => 'August 20, 2014' - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' - * short: e.g. 'M/d/yy' => '8/20/14' - * The exact format is dependent on the language - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use - * @return string Formatted date string - */ public function formatDate($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { return $this->format($timestamp, 'date', $format, $timeZone, $l); } - /** - * Formats the date of the given timestamp - * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' - * long: e.g. 'MMMM d, y' => 'August 20, 2014' - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' - * short: e.g. 'M/d/yy' => '8/20/14' - * The exact format is dependent on the language - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use - * @return string Formatted relative date string - */ public function formatDateRelativeDay($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { if (!str_ends_with($format, '^') && !str_ends_with($format, '*')) { $format .= '^'; @@ -115,18 +86,6 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { return $this->format($timestamp, 'date', $format, $timeZone, $l); } - /** - * Gives the relative date of the timestamp - * Only works for past dates - * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time - * @param \OCP\IL10N $l The locale to use - * @return string Formatted date span. Dates returned are: - * < 1 month => Today, Yesterday, n days ago - * < 13 month => last month, n months ago - * >= 13 month => last year, n years ago - */ public function formatDateSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) { $l = $this->getLocale($l); $timestamp = $this->getDateTime($timestamp); @@ -179,38 +138,10 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { } } - /** - * Formats the time of the given timestamp - * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' - * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' - * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' - * short: e.g. 'h:mm a' => '11:42 AM' - * The exact format is dependent on the language - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use - * @return string Formatted time string - */ public function formatTime($timestamp, $format = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { return $this->format($timestamp, 'time', $format, $timeZone, $l); } - /** - * Gives the relative past time of the timestamp - * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time - * @param \OCP\IL10N $l The locale to use - * @return string Formatted time span. Dates returned are: - * < 60 sec => seconds ago - * < 1 hour => n minutes ago - * < 1 day => n hours ago - * < 1 month => Yesterday, n days ago - * < 13 month => last month, n months ago - * >= 13 month => last year, n years ago - */ public function formatTimeSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) { $l = $this->getLocale($l); $timestamp = $this->getDateTime($timestamp); @@ -244,31 +175,10 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { } } - /** - * Formats the date and time of the given timestamp - * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $formatDate See formatDate() for description - * @param string $formatTime See formatTime() for description - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use - * @return string Formatted date and time string - */ public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l); } - /** - * Formats the date and time of the given timestamp - * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $formatDate See formatDate() for description - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable - * @param string $formatTime See formatTime() for description - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use - * @return string Formatted relative date and time string - */ public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { if (!str_ends_with($formatDate, '^') && !str_ends_with($formatDate, '*')) { $formatDate .= '^'; diff --git a/lib/private/DateTimeZone.php b/lib/private/DateTimeZone.php index ca2e314fabd..bd147a5c5c6 100644 --- a/lib/private/DateTimeZone.php +++ b/lib/private/DateTimeZone.php @@ -30,12 +30,6 @@ class DateTimeZone implements IDateTimeZone { $this->session = $session; } - /** - * Get the timezone of the current user, based on his session information and config data - * - * @param bool|int $timestamp - * @return \DateTimeZone - */ public function getTimeZone($timestamp = false) { $timeZone = $this->config->getUserValue($this->session->get('user_id'), 'core', 'timezone', null); if ($timeZone === null) { diff --git a/lib/private/Diagnostics/Event.php b/lib/private/Diagnostics/Event.php index cf36bf9f82a..4045ede9645 100644 --- a/lib/private/Diagnostics/Event.php +++ b/lib/private/Diagnostics/Event.php @@ -47,37 +47,22 @@ class Event implements IEvent { $this->end = $time; } - /** - * @return float - */ public function getStart() { return $this->start; } - /** - * @return string - */ public function getId() { return $this->id; } - /** - * @return string - */ public function getDescription() { return $this->description; } - /** - * @return float - */ public function getEnd() { return $this->end; } - /** - * @return float - */ public function getDuration() { if (!$this->end) { $this->end = microtime(true); diff --git a/lib/private/Diagnostics/EventLogger.php b/lib/private/Diagnostics/EventLogger.php index 40cbd3e9e5d..713fe9ff45a 100644 --- a/lib/private/Diagnostics/EventLogger.php +++ b/lib/private/Diagnostics/EventLogger.php @@ -52,9 +52,6 @@ class EventLogger implements IEventLogger { return $systemValue && $isDebugLevel; } - /** - * @inheritdoc - */ public function start($id, $description = '') { if ($this->activated) { $this->events[$id] = new Event($id, $description, microtime(true)); @@ -62,9 +59,6 @@ class EventLogger implements IEventLogger { } } - /** - * @inheritdoc - */ public function end($id) { if ($this->activated && isset($this->events[$id])) { $timing = $this->events[$id]; @@ -73,9 +67,6 @@ class EventLogger implements IEventLogger { } } - /** - * @inheritdoc - */ public function log($id, $description, $start, $end) { if ($this->activated) { $this->events[$id] = new Event($id, $description, $start); @@ -84,16 +75,10 @@ class EventLogger implements IEventLogger { } } - /** - * @inheritdoc - */ public function getEvents() { return $this->events; } - /** - * @inheritdoc - */ public function activate() { $this->activated = true; } diff --git a/lib/private/Diagnostics/Query.php b/lib/private/Diagnostics/Query.php index 81610074709..8ecd8e8ae80 100644 --- a/lib/private/Diagnostics/Query.php +++ b/lib/private/Diagnostics/Query.php @@ -36,30 +36,18 @@ class Query implements IQuery { $this->end = $time; } - /** - * @return array - */ public function getParams() { return $this->params; } - /** - * @return string - */ public function getSql() { return $this->sql; } - /** - * @return float - */ public function getStart() { return $this->start; } - /** - * @return float - */ public function getDuration() { return $this->end - $this->start; } diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php index 5efe99d1a74..c5d5906d92d 100644 --- a/lib/private/Diagnostics/QueryLogger.php +++ b/lib/private/Diagnostics/QueryLogger.php @@ -29,9 +29,6 @@ class QueryLogger implements IQueryLogger { */ private $activated = false; - /** - * @inheritdoc - */ public function startQuery($sql, ?array $params = null, ?array $types = null) { if ($this->activated) { $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); @@ -46,9 +43,6 @@ class QueryLogger implements IQueryLogger { return $stack; } - /** - * @inheritdoc - */ public function stopQuery() { if ($this->activated && $this->activeQuery) { $this->activeQuery->end(microtime(true)); @@ -58,16 +52,10 @@ class QueryLogger implements IQueryLogger { } } - /** - * @inheritdoc - */ public function getQueries() { return $this->queries->getData(); } - /** - * @inheritdoc - */ public function activate() { $this->activated = true; } diff --git a/lib/private/Encryption/File.php b/lib/private/Encryption/File.php index 26e643d1006..e6773ac6787 100644 --- a/lib/private/Encryption/File.php +++ b/lib/private/Encryption/File.php @@ -44,12 +44,6 @@ class File implements \OCP\Encryption\IFile { return $this->appManager; } - /** - * Get list of users with access to the file - * - * @param string $path to the file - * @return array{users: string[], public: bool} - */ public function getAccessList($path) { // Make sure that a share key is generated for the owner too [$owner, $ownerPath] = $this->util->getUidAndFilename($path); diff --git a/lib/private/Encryption/Keys/Storage.php b/lib/private/Encryption/Keys/Storage.php index 532d1a51dd6..f0bb2f74656 100644 --- a/lib/private/Encryption/Keys/Storage.php +++ b/lib/private/Encryption/Keys/Storage.php @@ -64,17 +64,11 @@ class Storage implements IStorage { $this->config = $config; } - /** - * @inheritdoc - */ public function getUserKey($uid, $keyId, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid); return base64_decode($this->getKeyWithUid($path, $uid)); } - /** - * @inheritdoc - */ public function getFileKey($path, $keyId, $encryptionModuleId) { $realFile = $this->util->stripPartialFileExtension($path); $keyDir = $this->util->getFileKeyDir($encryptionModuleId, $realFile); @@ -91,17 +85,11 @@ class Storage implements IStorage { return base64_decode($key); } - /** - * @inheritdoc - */ public function getSystemUserKey($keyId, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null); return base64_decode($this->getKeyWithUid($path, null)); } - /** - * @inheritdoc - */ public function setUserKey($uid, $keyId, $key, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid); return $this->setKey($path, [ @@ -110,9 +98,6 @@ class Storage implements IStorage { ]); } - /** - * @inheritdoc - */ public function setFileKey($path, $keyId, $key, $encryptionModuleId) { $keyDir = $this->util->getFileKeyDir($encryptionModuleId, $path); return $this->setKey($keyDir . $keyId, [ @@ -120,9 +105,6 @@ class Storage implements IStorage { ]); } - /** - * @inheritdoc - */ public function setSystemUserKey($keyId, $key, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null); return $this->setKey($path, [ @@ -131,9 +113,6 @@ class Storage implements IStorage { ]); } - /** - * @inheritdoc - */ public function deleteUserKey($uid, $keyId, $encryptionModuleId) { try { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid); @@ -152,25 +131,16 @@ class Storage implements IStorage { } } - /** - * @inheritdoc - */ public function deleteFileKey($path, $keyId, $encryptionModuleId) { $keyDir = $this->util->getFileKeyDir($encryptionModuleId, $path); return !$this->view->file_exists($keyDir . $keyId) || $this->view->unlink($keyDir . $keyId); } - /** - * @inheritdoc - */ public function deleteAllFileKeys($path) { $keyDir = $this->util->getFileKeyDir('', $path); return !$this->view->file_exists($keyDir) || $this->view->deleteAll($keyDir); } - /** - * @inheritdoc - */ public function deleteSystemUserKey($keyId, $encryptionModuleId) { $path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null); return !$this->view->file_exists($path) || $this->view->unlink($path); @@ -334,13 +304,6 @@ class Storage implements IStorage { return false; } - /** - * move keys if a file was renamed - * - * @param string $source - * @param string $target - * @return boolean - */ public function renameKeys($source, $target) { $sourcePath = $this->getPathToKeys($source); $targetPath = $this->getPathToKeys($target); @@ -356,13 +319,6 @@ class Storage implements IStorage { } - /** - * copy keys if a file was renamed - * - * @param string $source - * @param string $target - * @return boolean - */ public function copyKeys($source, $target) { $sourcePath = $this->getPathToKeys($source); $targetPath = $this->getPathToKeys($target); @@ -376,15 +332,6 @@ class Storage implements IStorage { return false; } - /** - * backup keys of a given encryption module - * - * @param string $encryptionModuleId - * @param string $purpose - * @param string $uid - * @return bool - * @since 12.0.0 - */ public function backupUserKeys($encryptionModuleId, $purpose, $uid) { $source = $uid . $this->encryption_base_dir . '/' . $encryptionModuleId; $backupDir = $uid . $this->backup_base_dir; diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php index a07c778bfe0..daeeb879387 100644 --- a/lib/private/Encryption/Manager.php +++ b/lib/private/Encryption/Manager.php @@ -34,11 +34,6 @@ class Manager implements IManager { $this->encryptionModules = []; } - /** - * Check if encryption is enabled - * - * @return bool true if enabled, false if not - */ public function isEnabled() { $installed = $this->config->getSystemValueBool('installed', false); if (!$installed) { @@ -82,14 +77,6 @@ class Manager implements IManager { return true; } - /** - * Registers an callback function which must return an encryption module instance - * - * @param string $id - * @param string $displayName - * @param callable $callback - * @throws Exceptions\ModuleAlreadyExistsException - */ public function registerEncryptionModule($id, $displayName, callable $callback) { if (isset($this->encryptionModules[$id])) { throw new Exceptions\ModuleAlreadyExistsException($id, $displayName); @@ -108,31 +95,14 @@ class Manager implements IManager { } } - /** - * Unregisters an encryption module - * - * @param string $moduleId - */ public function unregisterEncryptionModule($moduleId) { unset($this->encryptionModules[$moduleId]); } - /** - * get a list of all encryption modules - * - * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]] - */ public function getEncryptionModules() { return $this->encryptionModules; } - /** - * get a specific encryption module - * - * @param string $moduleId - * @return IEncryptionModule - * @throws Exceptions\ModuleDoesNotExistsException - */ public function getEncryptionModule($moduleId = '') { if (empty($moduleId)) { return $this->getDefaultEncryptionModule(); @@ -164,12 +134,6 @@ class Manager implements IManager { throw new Exceptions\ModuleDoesNotExistsException($message); } - /** - * set default encryption module Id - * - * @param string $moduleId - * @return bool - */ public function setDefaultEncryptionModule($moduleId) { try { $this->getEncryptionModule($moduleId); @@ -181,11 +145,6 @@ class Manager implements IManager { return true; } - /** - * get default encryption module Id - * - * @return string - */ public function getDefaultEncryptionModuleId() { return $this->config->getAppValue('core', 'default_encryption_module'); } diff --git a/lib/private/EventDispatcher/EventDispatcher.php b/lib/private/EventDispatcher/EventDispatcher.php index b7554c439ea..8ee525d560c 100644 --- a/lib/private/EventDispatcher/EventDispatcher.php +++ b/lib/private/EventDispatcher/EventDispatcher.php @@ -59,9 +59,6 @@ class EventDispatcher implements IEventDispatcher { return $this->dispatcher->hasListeners($eventName); } - /** - * @deprecated - */ public function dispatch(string $eventName, Event $event): void { $this->dispatcher->dispatch($event, $eventName); diff --git a/lib/private/EventSource.php b/lib/private/EventSource.php index 18af6e35832..5dd6c5c30c3 100644 --- a/lib/private/EventSource.php +++ b/lib/private/EventSource.php @@ -62,16 +62,6 @@ class EventSource implements IEventSource { flush(); } - /** - * send a message to the client - * - * @param string $type - * @param mixed $data - * - * @throws \BadMethodCallException - * if only one parameter is given, a typeless message will be send with that parameter as data - * @suppress PhanDeprecatedFunction - */ public function send($type, $data = null) { if ($data and !preg_match('/^[A-Za-z0-9_]+$/', $type)) { throw new \BadMethodCallException('Type needs to be alphanumeric ('. $type .')'); @@ -95,9 +85,6 @@ class EventSource implements IEventSource { flush(); } - /** - * close the connection of the event source - */ public function close() { $this->send('__internal__', 'close'); //server side closing can be an issue, let the client do it } diff --git a/lib/private/Federation/CloudFederationFactory.php b/lib/private/Federation/CloudFederationFactory.php index f5f25d14ea1..12fee461782 100644 --- a/lib/private/Federation/CloudFederationFactory.php +++ b/lib/private/Federation/CloudFederationFactory.php @@ -6,40 +6,12 @@ namespace OC\Federation; use OCP\Federation\ICloudFederationFactory; -use OCP\Federation\ICloudFederationNotification; -use OCP\Federation\ICloudFederationShare; class CloudFederationFactory implements ICloudFederationFactory { - /** - * get a CloudFederationShare Object to prepare a share you want to send - * - * @param string $shareWith - * @param string $name resource name (e.g. document.odt) - * @param string $description share description (optional) - * @param string $providerId resource UID on the provider side - * @param string $owner provider specific UID of the user who owns the resource - * @param string $ownerDisplayName display name of the user who shared the item - * @param string $sharedBy provider specific UID of the user who shared the resource - * @param string $sharedByDisplayName display name of the user who shared the resource - * @param string $sharedSecret used to authenticate requests across servers - * @param string $shareType ('group' or 'user' share) - * @param $resourceType ('file', 'calendar',...) - * @return ICloudFederationShare - * - * @since 14.0.0 - */ public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $sharedSecret, $shareType, $resourceType) { return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $shareType, $resourceType, $sharedSecret); } - /** - * get a Cloud FederationNotification object to prepare a notification you - * want to send - * - * @return ICloudFederationNotification - * - * @since 14.0.0 - */ public function getCloudFederationNotification() { return new CloudFederationNotification(); } diff --git a/lib/private/Federation/CloudFederationNotification.php b/lib/private/Federation/CloudFederationNotification.php index 855580843ba..2852f02b52f 100644 --- a/lib/private/Federation/CloudFederationNotification.php +++ b/lib/private/Federation/CloudFederationNotification.php @@ -17,16 +17,6 @@ use OCP\Federation\ICloudFederationNotification; class CloudFederationNotification implements ICloudFederationNotification { private $message = []; - /** - * add a message to the notification - * - * @param string $notificationType (e.g. SHARE_ACCEPTED) - * @param string $resourceType (e.g. file, calendar, contact,...) - * @param string $providerId id of the share - * @param array $notification payload of the notification - * - * @since 14.0.0 - */ public function setMessage($notificationType, $resourceType, $providerId, array $notification) { $this->message = [ 'notificationType' => $notificationType, @@ -36,13 +26,6 @@ class CloudFederationNotification implements ICloudFederationNotification { ]; } - /** - * get message, ready to send out - * - * @return array - * - * @since 14.0.0 - */ public function getMessage() { return $this->message; } diff --git a/lib/private/Federation/CloudFederationProviderManager.php b/lib/private/Federation/CloudFederationProviderManager.php index 79b37b44c82..ed270b763d0 100644 --- a/lib/private/Federation/CloudFederationProviderManager.php +++ b/lib/private/Federation/CloudFederationProviderManager.php @@ -12,7 +12,6 @@ use OC\AppFramework\Http; use OCP\App\IAppManager; use OCP\Federation\Exceptions\ProviderDoesNotExistsException; use OCP\Federation\ICloudFederationNotification; -use OCP\Federation\ICloudFederationProvider; use OCP\Federation\ICloudFederationProviderManager; use OCP\Federation\ICloudFederationShare; use OCP\Federation\ICloudIdManager; @@ -45,13 +44,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager } - /** - * Registers an callback function which must return an cloud federation provider - * - * @param string $resourceType which resource type does the provider handles - * @param string $displayName user facing name of the federated share provider - * @param callable $callback - */ public function addCloudFederationProvider($resourceType, $displayName, callable $callback) { $this->cloudFederationProvider[$resourceType] = [ 'resourceType' => $resourceType, @@ -60,31 +52,14 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager ]; } - /** - * remove cloud federation provider - * - * @param string $providerId - */ public function removeCloudFederationProvider($providerId) { unset($this->cloudFederationProvider[$providerId]); } - /** - * get a list of all cloudFederationProviders - * - * @return array [resourceType => ['resourceType' => $resourceType, 'displayName' => $displayName, 'callback' => callback]] - */ public function getAllCloudFederationProviders() { return $this->cloudFederationProvider; } - /** - * get a specific cloud federation provider - * - * @param string $resourceType - * @return ICloudFederationProvider - * @throws ProviderDoesNotExistsException - */ public function getCloudFederationProvider($resourceType) { if (isset($this->cloudFederationProvider[$resourceType])) { return call_user_func($this->cloudFederationProvider[$resourceType]['callback']); @@ -93,9 +68,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager } } - /** - * @deprecated 29.0.0 - Use {@see sendCloudShare()} instead and handle errors manually - */ public function sendShare(ICloudFederationShare $share) { $cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith()); try { @@ -132,11 +104,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager return false; } - /** - * @param ICloudFederationShare $share - * @return IResponse - * @throws OCMProviderException - */ public function sendCloudShare(ICloudFederationShare $share): IResponse { $cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith()); $ocmProvider = $this->discoveryService->discover($cloudID->getRemote()); @@ -160,12 +127,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager } } - /** - * @param string $url - * @param ICloudFederationNotification $notification - * @return array|false - * @deprecated 29.0.0 - Use {@see sendCloudNotification()} instead and handle errors manually - */ public function sendNotification($url, ICloudFederationNotification $notification) { try { $ocmProvider = $this->discoveryService->discover($url); @@ -194,12 +155,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager return false; } - /** - * @param string $url - * @param ICloudFederationNotification $notification - * @return IResponse - * @throws OCMProviderException - */ public function sendCloudNotification(string $url, ICloudFederationNotification $notification): IResponse { $ocmProvider = $this->discoveryService->discover($url); @@ -222,11 +177,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager } } - /** - * check if the new cloud federation API is ready to be used - * - * @return bool - */ public function isReady() { return $this->appManager->isEnabledForUser('cloud_federation_api'); } diff --git a/lib/private/Federation/CloudFederationShare.php b/lib/private/Federation/CloudFederationShare.php index aa86905f234..7eee5e76745 100644 --- a/lib/private/Federation/CloudFederationShare.php +++ b/lib/private/Federation/CloudFederationShare.php @@ -69,123 +69,46 @@ class CloudFederationShare implements ICloudFederationShare { $this->setResourceType($resourceType); } - /** - * set uid of the recipient - * - * @param string $user - * - * @since 14.0.0 - */ public function setShareWith($user) { $this->share['shareWith'] = $user; } - /** - * set resource name (e.g. document.odt) - * - * @param string $name - * - * @since 14.0.0 - */ public function setResourceName($name) { $this->share['name'] = $name; } - /** - * set resource type (e.g. file, calendar, contact,...) - * - * @param string $resourceType - * - * @since 14.0.0 - */ public function setResourceType($resourceType) { $this->share['resourceType'] = $resourceType; } - /** - * set resource description (optional) - * - * @param string $description - * - * @since 14.0.0 - */ public function setDescription($description) { $this->share['description'] = $description; } - /** - * set provider ID (e.g. file ID) - * - * @param string $providerId - * - * @since 14.0.0 - */ public function setProviderId($providerId) { $this->share['providerId'] = $providerId; } - /** - * set owner UID - * - * @param string $owner - * - * @since 14.0.0 - */ public function setOwner($owner) { $this->share['owner'] = $owner; } - /** - * set owner display name - * - * @param string $ownerDisplayName - * - * @since 14.0.0 - */ public function setOwnerDisplayName($ownerDisplayName) { $this->share['ownerDisplayName'] = $ownerDisplayName; } - /** - * set UID of the user who sends the share - * - * @param string $sharedBy - * - * @since 14.0.0 - */ public function setSharedBy($sharedBy) { $this->share['sharedBy'] = $sharedBy; } - /** - * set display name of the user who sends the share - * - * @param $sharedByDisplayName - * - * @since 14.0.0 - */ public function setSharedByDisplayName($sharedByDisplayName) { $this->share['sharedByDisplayName'] = $sharedByDisplayName; } - /** - * set protocol specification - * - * @param array $protocol - * - * @since 14.0.0 - */ public function setProtocol(array $protocol) { $this->share['protocol'] = $protocol; } - /** - * share type (group or user) - * - * @param string $shareType - * - * @since 14.0.0 - */ public function setShareType($shareType) { if ($shareType === 'group' || $shareType === IShare::TYPE_REMOTE_GROUP) { $this->share['shareType'] = 'group'; @@ -194,145 +117,54 @@ class CloudFederationShare implements ICloudFederationShare { } } - /** - * get the whole share, ready to send out - * - * @return array - * - * @since 14.0.0 - */ public function getShare() { return $this->share; } - /** - * get uid of the recipient - * - * @return string - * - * @since 14.0.0 - */ public function getShareWith() { return $this->share['shareWith']; } - /** - * get resource name (e.g. file, calendar, contact,...) - * - * @return string - * - * @since 14.0.0 - */ public function getResourceName() { return $this->share['name']; } - /** - * get resource type (e.g. file, calendar, contact,...) - * - * @return string - * - * @since 14.0.0 - */ public function getResourceType() { return $this->share['resourceType']; } - /** - * get resource description (optional) - * - * @return string - * - * @since 14.0.0 - */ public function getDescription() { return $this->share['description']; } - /** - * get provider ID (e.g. file ID) - * - * @return string - * - * @since 14.0.0 - */ public function getProviderId() { return $this->share['providerId']; } - /** - * get owner UID - * - * @return string - * - * @since 14.0.0 - */ public function getOwner() { return $this->share['owner']; } - /** - * get owner display name - * - * @return string - * - * @since 14.0.0 - */ public function getOwnerDisplayName() { return $this->share['ownerDisplayName']; } - /** - * get UID of the user who sends the share - * - * @return string - * - * @since 14.0.0 - */ public function getSharedBy() { return $this->share['sharedBy']; } - /** - * get display name of the user who sends the share - * - * @return string - * - * @since 14.0.0 - */ public function getSharedByDisplayName() { return $this->share['sharedByDisplayName']; } - /** - * get share type (group or user) - * - * @return string - * - * @since 14.0.0 - */ public function getShareType() { return $this->share['shareType']; } - /** - * get share Secret - * - * @return string - * - * @since 14.0.0 - */ public function getShareSecret() { return $this->share['protocol']['options']['sharedSecret']; } - /** - * get protocol specification - * - * @return array - * - * @since 14.0.0 - */ public function getProtocol() { return $this->share['protocol']; } diff --git a/lib/private/Federation/CloudId.php b/lib/private/Federation/CloudId.php index c20dbfc6418..c9392914b53 100644 --- a/lib/private/Federation/CloudId.php +++ b/lib/private/Federation/CloudId.php @@ -34,11 +34,6 @@ class CloudId implements ICloudId { $this->displayName = $displayName; } - /** - * The full remote cloud id - * - * @return string - */ public function getId(): string { return $this->id; } @@ -52,20 +47,10 @@ class CloudId implements ICloudId { return str_replace('https://', '', str_replace('http://', '', $this->getId())); } - /** - * The username on the remote server - * - * @return string - */ public function getUser(): string { return $this->user; } - /** - * The base address of the remote server - * - * @return string - */ public function getRemote(): string { return $this->remote; } diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 69d48a148b3..4f11ace4b7f 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -71,11 +71,6 @@ class CloudIdManager implements ICloudIdManager { } } - /** - * @param string $cloudId - * @return ICloudId - * @throws \InvalidArgumentException - */ public function resolveCloudId(string $cloudId): ICloudId { // TODO magic here to get the url and user instead of just splitting on @ @@ -139,11 +134,6 @@ class CloudIdManager implements ICloudIdManager { return null; } - /** - * @param string $user - * @param string|null $remote - * @return CloudId - */ public function getCloudId(string $user, ?string $remote): ICloudId { $isLocal = $remote === null; if ($isLocal) { @@ -185,10 +175,6 @@ class CloudIdManager implements ICloudIdManager { return new CloudId($id, $user, $remote, $displayName); } - /** - * @param string $url - * @return string - */ public function removeProtocolFromUrl(string $url, bool $httpsOnly = false): string { if (str_starts_with($url, 'https://')) { return substr($url, 8); @@ -230,10 +216,6 @@ class CloudIdManager implements ICloudIdManager { return $remote; } - /** - * @param string $cloudId - * @return bool - */ public function isValidCloudId(string $cloudId): bool { return str_contains($cloudId, '@'); } diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index a8d9067050d..e7f1e259e03 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -97,21 +97,10 @@ class Cache implements ICache { return $this->storageCache; } - /** - * Get the numeric storage id for this cache's storage - * - * @return int - */ public function getNumericStorageId() { return $this->storageCache->getNumericId(); } - /** - * get the stored metadata of a file or folder - * - * @param string | int $file either the path of a file or folder or the file id for a file or folder - * @return ICacheEntry|false the cache entry as array or false if the file is not found in the cache - */ public function get($file) { $query = $this->getQueryBuilder(); $query->selectFileCache(); @@ -178,23 +167,11 @@ class Cache implements ICache { return new CacheEntry($data); } - /** - * get the metadata of all files stored in $folder - * - * @param string $folder - * @return ICacheEntry[] - */ public function getFolderContents($folder) { $fileId = $this->getId($folder); return $this->getFolderContentsById($fileId); } - /** - * get the metadata of all files stored in $folder - * - * @param int $fileId the file id of the folder - * @return ICacheEntry[] - */ public function getFolderContentsById($fileId) { if ($fileId > -1) { $query = $this->getQueryBuilder(); @@ -217,15 +194,6 @@ class Cache implements ICache { return []; } - /** - * insert or update meta data for a file or folder - * - * @param string $file - * @param array $data - * - * @return int file id - * @throws \RuntimeException - */ public function put($file, array $data) { if (($id = $this->getId($file)) > -1) { $this->update($id, $data); @@ -235,15 +203,6 @@ class Cache implements ICache { } } - /** - * insert meta data for a new file or folder - * - * @param string $file - * @param array $data - * - * @return int file id - * @throws \RuntimeException - */ public function insert($file, array $data) { // normalize file $file = $this->normalize($file); @@ -316,12 +275,6 @@ class Cache implements ICache { } } - /** - * update the metadata of an existing file or folder in the cache - * - * @param int $id the fileid of the existing file or folder - * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged - */ public function update($id, array $data) { if (isset($data['path'])) { // normalize path @@ -445,16 +398,6 @@ class Cache implements ICache { return [$params, array_filter($extensionParams)]; } - /** - * get the file id for a file - * - * A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file - * - * File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing - * - * @param string $file - * @return int - */ public function getId($file) { // normalize file $file = $this->normalize($file); @@ -472,12 +415,6 @@ class Cache implements ICache { return $id === false ? -1 : (int)$id; } - /** - * get the id of the parent folder of a file - * - * @param string $file - * @return int - */ public function getParentId($file) { if ($file === '') { return -1; @@ -495,23 +432,10 @@ class Cache implements ICache { return $parent; } - /** - * check if a file is available in the cache - * - * @param string $file - * @return bool - */ public function inCache($file) { return $this->getId($file) != -1; } - /** - * remove a file or folder from the cache - * - * when removing a folder from the cache all files and folders inside the folder will be removed as well - * - * @param string $file - */ public function remove($file) { $entry = $this->get($file); @@ -614,12 +538,6 @@ class Cache implements ICache { } } - /** - * Move a file or folder in the cache - * - * @param string $source - * @param string $target - */ public function move($source, $target) { $this->moveFromCache($this, $source, $target); } @@ -638,15 +556,6 @@ class Cache implements ICache { return $this->storage->instanceOfStorage(Encryption::class); } - /** - * Move a file or folder in the cache - * - * @param ICache $sourceCache - * @param string $sourcePath - * @param string $targetPath - * @throws \OC\DatabaseException - * @throws \Exception if the given storages have an invalid id - */ public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { if ($sourceCache instanceof Cache) { // normalize source and target @@ -805,18 +714,6 @@ class Cache implements ICache { $query->execute(); } - /** - * Get the scan status of a file - * - * - Cache::NOT_FOUND: File is not in the cache - * - Cache::PARTIAL: File is not stored in the cache but some incomplete data is known - * - Cache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned - * - Cache::COMPLETE: The file or folder, with all it's children) are fully scanned - * - * @param string $file - * - * @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE - */ public function getStatus($file) { // normalize file $file = $this->normalize($file); @@ -846,24 +743,11 @@ class Cache implements ICache { } } - /** - * search for files matching $pattern - * - * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%') - * @return ICacheEntry[] an array of cache entries where the name matches the search pattern - */ public function search($pattern) { $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', $pattern); return $this->searchQuery(new SearchQuery($operator, 0, 0, [], null)); } - /** - * search for files by mimetype - * - * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image') - * where it will search for all mimetypes in the group ('image/*') - * @return ICacheEntry[] an array of cache entries where the mimetype matches the search - */ public function searchByMime($mimetype) { if (!str_contains($mimetype, '/')) { $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'); @@ -1045,15 +929,6 @@ class Cache implements ICache { }, $files); } - /** - * find a folder in the cache which has not been fully scanned - * - * If multiple incomplete folders are in the cache, the one with the highest id will be returned, - * use the one with the highest id gives the best result with the background scanner, since that is most - * likely the folder where we stopped scanning previously - * - * @return string|false the path of the folder or false when no folder matched - */ public function getIncomplete() { // we select the fileid here first instead of directly selecting the path since this helps mariadb/mysql // to use the correct index. @@ -1079,12 +954,6 @@ class Cache implements ICache { return $path ?? false; } - /** - * get the path of a file on this storage by it's file id - * - * @param int $id the file id of the file or folder to search - * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache - */ public function getPathById($id) { $query = $this->getQueryBuilder(); $query->select('path') @@ -1136,24 +1005,10 @@ class Cache implements ICache { } } - /** - * normalize the given path - * - * @param string $path - * @return string - */ public function normalize($path) { return trim(\OC_Util::normalizeUnicode($path), '/'); } - /** - * Copy a file or folder in the cache - * - * @param ICache $sourceCache - * @param ICacheEntry $sourceEntry - * @param string $targetPath - * @return int fileId of copied entry - */ public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { if ($sourceEntry->getId() < 0) { throw new \RuntimeException('Invalid source cache entry on copyFromCache'); diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php index e9417c8012a..19f1dc941d3 100644 --- a/lib/private/Files/Cache/CacheEntry.php +++ b/lib/private/Files/Cache/CacheEntry.php @@ -34,9 +34,6 @@ class CacheEntry implements ICacheEntry { unset($this->data[$offset]); } - /** - * @return mixed - */ #[\ReturnTypeWillChange] public function offsetGet($offset) { if (isset($this->data[$offset])) { diff --git a/lib/private/Files/Cache/FileAccess.php b/lib/private/Files/Cache/FileAccess.php index 11a95b5d897..5164318ea1b 100644 --- a/lib/private/Files/Cache/FileAccess.php +++ b/lib/private/Files/Cache/FileAccess.php @@ -68,10 +68,6 @@ class FileAccess implements IFileAccess { return $result; } - /** - * @param int[] $fileIds - * @return array<int, CacheEntry> - */ public function getByFileIds(array $fileIds): array { $query = $this->getQuery()->selectFileCache(); $query->andWhere($query->expr()->in('filecache.fileid', $query->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY))); @@ -80,11 +76,6 @@ class FileAccess implements IFileAccess { return $this->rowsToEntries($rows); } - /** - * @param int[] $fileIds - * @param int $storageId - * @return array<int, CacheEntry> - */ public function getByFileIdsInStorage(array $fileIds, int $storageId): array { $fileIds = array_values($fileIds); $query = $this->getQuery()->selectFileCache(); diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index bbeb8c42075..eaf1dabf9aa 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -46,11 +46,6 @@ class Propagator implements IPropagator { } - /** - * @param string $internalPath - * @param int $time - * @param int $sizeDifference number of bytes the file has grown - */ public function propagateChange($internalPath, $time, $sizeDifference = 0) { // Do not propagate changes in ignored paths foreach ($this->ignore as $ignore) { @@ -142,14 +137,6 @@ class Propagator implements IPropagator { return $parents; } - /** - * Mark the beginning of a propagation batch - * - * Note that not all cache setups support propagation in which case this will be a noop - * - * Batching for cache setups that do support it has to be explicit since the cache state is not fully consistent - * before the batch is committed. - */ public function beginBatch() { $this->inBatch = true; } @@ -169,9 +156,6 @@ class Propagator implements IPropagator { } } - /** - * Commit the active propagation batch - */ public function commitBatch() { if (!$this->inBatch) { throw new \BadMethodCallException('Not in batch'); diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index c85104ac4b9..3d645fdcb72 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -101,18 +101,6 @@ class Scanner extends BasicEmitter implements IScanner { return $data; } - /** - * scan a single file and store it in the cache - * - * @param string $file - * @param int $reuseExisting - * @param int $parentId - * @param array|null|false $cacheData existing data in the cache for the file to be scanned - * @param bool $lock set to false to disable getting an additional read lock during scanning - * @param null $data the metadata for the file, as returned by the storage - * @return array|null an array of metadata of the scanned file - * @throws \OCP\Lock\LockedException - */ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { if ($file !== '') { try { @@ -305,15 +293,6 @@ class Scanner extends BasicEmitter implements IScanner { } } - /** - * scan a folder and all it's children - * - * @param string $path - * @param bool $recursive - * @param int $reuse - * @param bool $lock set to false to disable getting an additional read lock during scanning - * @return array|null an array of the meta data of the scanned file or folder - */ public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { if ($reuse === -1) { $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG; @@ -553,14 +532,6 @@ class Scanner extends BasicEmitter implements IScanner { return $childQueue; } - /** - * check if the file should be ignored when scanning - * NOTE: files with a '.part' extension are ignored as well! - * prevents unfinished put requests to be scanned - * - * @param string $file - * @return boolean - */ public static function isPartialFile($file) { if (pathinfo($file, PATHINFO_EXTENSION) === 'part') { return true; @@ -572,9 +543,6 @@ class Scanner extends BasicEmitter implements IScanner { return false; } - /** - * walk over any folders that are not fully scanned yet and scan them - */ public function backgroundScan() { if ($this->storage->instanceOfStorage(Jail::class)) { // for jail storage wrappers (shares, groupfolders) we run the background scan on the source storage diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index eab68b4f545..67329e0e3d9 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -71,21 +71,10 @@ class Updater implements IUpdater { $this->enabled = true; } - /** - * Get the propagator for etags and mtime for the view the updater works on - * - * @return Propagator - */ public function getPropagator() { return $this->propagator; } - /** - * Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem - * - * @param string $path the path of the file to propagate the changes for - * @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used - */ public function propagate($path, $time = null) { if (Scanner::isPartialFile($path)) { return; @@ -93,12 +82,6 @@ class Updater implements IUpdater { $this->propagator->propagateChange($path, $time); } - /** - * Update the cache for $path and update the size, etag and mtime of the parent folders - * - * @param string $path - * @param int $time - */ public function update($path, $time = null, ?int $sizeDifference = null) { if (!$this->enabled or Scanner::isPartialFile($path)) { return; @@ -126,11 +109,6 @@ class Updater implements IUpdater { $this->propagator->propagateChange($path, $time, $sizeDifference ?? 0); } - /** - * Remove $path from the cache and update the size, etag and mtime of the parent folders - * - * @param string $path - */ public function remove($path) { if (!$this->enabled or Scanner::isPartialFile($path)) { return; @@ -156,13 +134,6 @@ class Updater implements IUpdater { } } - /** - * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders - * - * @param IStorage $sourceStorage - * @param string $source - * @param string $target - */ public function renameFromStorage(IStorage $sourceStorage, $source, $target) { if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) { return; diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index 2e42b716695..7863d2b71e3 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -7,7 +7,6 @@ */ namespace OC\Files\Cache; -use OCP\Files\Cache\ICacheEntry; use OCP\Files\Cache\IWatcher; /** @@ -42,27 +41,14 @@ class Watcher implements IWatcher { $this->scanner = $storage->getScanner(); } - /** - * @param int $policy either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS - */ public function setPolicy($policy) { $this->watchPolicy = $policy; } - /** - * @return int either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS - */ public function getPolicy() { return $this->watchPolicy; } - /** - * check $path for updates and update if needed - * - * @param string $path - * @param ICacheEntry|null $cachedEntry - * @return boolean true if path was updated - */ public function checkUpdate($path, $cachedEntry = null) { if (is_null($cachedEntry)) { $cachedEntry = $this->cache->get($path); @@ -82,12 +68,6 @@ class Watcher implements IWatcher { } } - /** - * Update the cache for changes to $path - * - * @param string $path - * @param ICacheEntry $cachedData - */ public function update($path, $cachedData) { if ($this->storage->is_dir($path)) { $this->scanner->scan($path, Scanner::SCAN_SHALLOW); @@ -102,13 +82,6 @@ class Watcher implements IWatcher { } } - /** - * Check if the cache for $path needs to be updated - * - * @param string $path - * @param ICacheEntry $cachedData - * @return bool - */ public function needsUpdate($path, $cachedData) { if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and !in_array($path, $this->checkedPaths))) { $this->checkedPaths[] = $path; @@ -117,11 +90,6 @@ class Watcher implements IWatcher { return false; } - /** - * remove deleted files in $path from the cache - * - * @param string $path - */ public function cleanFolder($path) { $cachedContent = $this->cache->getFolderContents($path); foreach ($cachedContent as $entry) { diff --git a/lib/private/Files/Config/CachedMountInfo.php b/lib/private/Files/Config/CachedMountInfo.php index 80423dcae40..dc1504c943c 100644 --- a/lib/private/Files/Config/CachedMountInfo.php +++ b/lib/private/Files/Config/CachedMountInfo.php @@ -54,30 +54,18 @@ class CachedMountInfo implements ICachedMountInfo { $this->key = $rootId . '::' . $mountPoint; } - /** - * @return IUser - */ public function getUser(): IUser { return $this->user; } - /** - * @return int the numeric storage id of the mount - */ public function getStorageId(): int { return $this->storageId; } - /** - * @return int the fileid of the root of the mount - */ public function getRootId(): int { return $this->rootId; } - /** - * @return Node|null the root node of the mount - */ public function getMountPointNode(): ?Node { // TODO injection etc Filesystem::initMountPoints($this->getUser()->getUID()); @@ -85,28 +73,14 @@ class CachedMountInfo implements ICachedMountInfo { return $userNode->getParent()->getFirstNodeById($this->getRootId()); } - /** - * @return string the mount point of the mount for the user - */ public function getMountPoint(): string { return $this->mountPoint; } - /** - * Get the id of the configured mount - * - * @return int|null mount id or null if not applicable - * @since 9.1.0 - */ public function getMountId(): ?int { return $this->mountId; } - /** - * Get the internal path (within the storage) of the root of the mount - * - * @return string - */ public function getRootInternalPath(): string { return $this->rootInternalPath; } diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index 1dbc469c8c3..36e19854e46 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -138,13 +138,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { return array_merge($lateMounts, $firstMounts); } - /** - * Get the configured home mount for this user - * - * @param \OCP\IUser $user - * @return \OCP\Files\Mount\IMountPoint - * @since 9.1.0 - */ public function getHomeMountForUser(IUser $user) { /** @var \OCP\Files\Config\IHomeMountProvider[] $providers */ $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin @@ -157,11 +150,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { throw new \Exception('No home storage configured for user ' . $user); } - /** - * Add a provider for mount points - * - * @param \OCP\Files\Config\IMountProvider $provider - */ public function registerProvider(IMountProvider $provider) { $this->providers[] = $provider; @@ -183,22 +171,11 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { }); } - /** - * Add a provider for home mount points - * - * @param \OCP\Files\Config\IHomeMountProvider $provider - * @since 9.1.0 - */ public function registerHomeProvider(IHomeMountProvider $provider) { $this->homeProviders[] = $provider; $this->emit('\OC\Files\Config', 'registerHomeMountProvider', [$provider]); } - /** - * Get the mount cache which can be used to search for mounts without setting up the filesystem - * - * @return IUserMountCache - */ public function getMountCache() { return $this->mountCache; } @@ -207,12 +184,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { $this->rootProviders[] = $provider; } - /** - * Get all root mountpoints - * - * @return \OCP\Files\Mount\IMountPoint[] - * @since 20.0.0 - */ public function getRootMounts(): array { $loader = $this->loader; $mounts = array_map(function (IRootMountProvider $provider) use ($loader) { diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index 94da770b63f..e3a41131af0 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -11,7 +11,6 @@ use OC\User\LazyUser; use OCP\Cache\CappedMemoryCache; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Diagnostics\IEventLogger; -use OCP\Files\Config\ICachedMountFileInfo; use OCP\Files\Config\ICachedMountInfo; use OCP\Files\Config\IUserMountCache; use OCP\Files\NotFoundException; @@ -224,10 +223,6 @@ class UserMountCache implements IUserMountCache { } } - /** - * @param IUser $user - * @return ICachedMountInfo[] - */ public function getMountsForUser(IUser $user) { $userUID = $user->getUID(); if (!$this->userManager->userExists($userUID)) { @@ -268,11 +263,6 @@ class UserMountCache implements IUserMountCache { return $query->executeQuery()->fetchOne() ?: ''; } - /** - * @param int $numericStorageId - * @param string|null $user limit the results to a single user - * @return CachedMountInfo[] - */ public function getMountsForStorageId($numericStorageId, $user = null) { $builder = $this->connection->getQueryBuilder(); $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class') @@ -291,10 +281,6 @@ class UserMountCache implements IUserMountCache { return array_filter(array_map([$this, 'dbRowToMountInfo'], $rows)); } - /** - * @param int $rootFileId - * @return CachedMountInfo[] - */ public function getMountsForRootId($rootFileId) { $builder = $this->connection->getQueryBuilder(); $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class') @@ -338,12 +324,6 @@ class UserMountCache implements IUserMountCache { return $this->cacheInfoCache[$fileId]; } - /** - * @param int $fileId - * @param string|null $user optionally restrict the results to a single user - * @return ICachedMountFileInfo[] - * @since 9.0.0 - */ public function getMountsForFileId($fileId, $user = null) { try { [$storageId, $internalPath] = $this->getCacheInfoFromFileId($fileId); @@ -380,11 +360,6 @@ class UserMountCache implements IUserMountCache { }, $filteredMounts); } - /** - * Remove all cached mounts for a user - * - * @param IUser $user - */ public function removeUserMounts(IUser $user) { $builder = $this->connection->getQueryBuilder(); @@ -410,10 +385,6 @@ class UserMountCache implements IUserMountCache { $query->execute(); } - /** - * @param array $users - * @return array - */ public function getUsedSpaceForUsers(array $users) { $builder = $this->connection->getQueryBuilder(); diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 0679dc1ae72..b31387574aa 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -106,9 +106,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { }; } - /** - * @return string - */ public function getPath() { return $this->path; } @@ -117,48 +114,28 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { return $this->storage; } - /** - * @return string - */ public function getInternalPath() { return $this->internalPath; } - /** - * Get FileInfo ID or null in case of part file - * - * @return int|null - */ public function getId() { return isset($this->data['fileid']) ? (int)$this->data['fileid'] : null; } - /** - * @return string - */ public function getMimetype() { return $this->data['mimetype']; } - /** - * @return string - */ public function getMimePart() { return $this->data['mimepart']; } - /** - * @return string - */ public function getName() { return empty($this->data['name']) ? basename($this->getPath()) : $this->data['name']; } - /** - * @return string - */ public function getEtag() { $this->updateEntryFromSubMounts(); if (count($this->childEtags) > 0) { @@ -169,10 +146,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { } } - /** - * @param bool $includeMounts - * @return int|float - */ public function getSize($includeMounts = true) { if ($includeMounts) { $this->updateEntryFromSubMounts(); @@ -187,17 +160,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { } } - /** - * @return int - */ public function getMTime() { $this->updateEntryFromSubMounts(); return (int)$this->data['mtime']; } - /** - * @return bool - */ public function isEncrypted() { return $this->data['encrypted'] ?? false; } @@ -209,16 +176,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { return isset($this->data['encryptedVersion']) ? (int)$this->data['encryptedVersion'] : 1; } - /** - * @return int - */ public function getPermissions() { return (int)$this->data['permissions']; } - /** - * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER - */ public function getType() { if (!isset($this->data['type'])) { $this->data['type'] = ($this->getMimetype() === self::MIMETYPE_FOLDER) ? self::TYPE_FOLDER : self::TYPE_FILE; @@ -238,48 +199,26 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { return ($this->getPermissions() & $permissions) === $permissions; } - /** - * @return bool - */ public function isReadable() { return $this->checkPermissions(\OCP\Constants::PERMISSION_READ); } - /** - * @return bool - */ public function isUpdateable() { return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE); } - /** - * Check whether new files or folders can be created inside this folder - * - * @return bool - */ public function isCreatable() { return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE); } - /** - * @return bool - */ public function isDeletable() { return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE); } - /** - * @return bool - */ public function isShareable() { return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE); } - /** - * Check if a file or folder is shared - * - * @return bool - */ public function isShared() { return $this->mount instanceof ISharedMountPoint; } @@ -289,20 +228,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { return !$isHome && !$this->isShared(); } - /** - * Get the mountpoint the file belongs to - * - * @return \OCP\Files\Mount\IMountPoint - */ public function getMountPoint() { return $this->mount; } - /** - * Get the owner of the file - * - * @return ?IUser - */ public function getOwner() { return $this->owner; } @@ -363,9 +292,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { } } - /** - * @inheritdoc - */ public function getChecksum() { return $this->data['checksum']; } @@ -386,10 +312,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { return $this->data['parent'] ?? -1; } - /** - * @inheritDoc - * @return array<string, int|string|bool|float|string[]|int[]> - */ public function getMetadata(): array { return $this->data['metadata'] ?? []; } diff --git a/lib/private/Files/FilenameValidator.php b/lib/private/Files/FilenameValidator.php index fde45068df7..96e0c736c3b 100644 --- a/lib/private/Files/FilenameValidator.php +++ b/lib/private/Files/FilenameValidator.php @@ -156,9 +156,6 @@ class FilenameValidator implements IFilenameValidator { return $this->forbiddenCharacters; } - /** - * @inheritdoc - */ public function isFilenameValid(string $filename): bool { try { $this->validateFilename($filename); @@ -168,9 +165,6 @@ class FilenameValidator implements IFilenameValidator { return true; } - /** - * @inheritdoc - */ public function validateFilename(string $filename): void { $trimmed = trim($filename); if ($trimmed === '') { diff --git a/lib/private/Files/Mount/CacheMountProvider.php b/lib/private/Files/Mount/CacheMountProvider.php index 27c7eec9da3..44b3f6a63f0 100644 --- a/lib/private/Files/Mount/CacheMountProvider.php +++ b/lib/private/Files/Mount/CacheMountProvider.php @@ -30,13 +30,6 @@ class CacheMountProvider implements IMountProvider { $this->config = $config; } - /** - * Get the cache mount for a user - * - * @param IUser $user - * @param IStorageFactory $loader - * @return \OCP\Files\Mount\IMountPoint[] - */ public function getMountsForUser(IUser $user, IStorageFactory $loader) { $cacheBaseDir = $this->config->getSystemValueString('cache_path', ''); if ($cacheBaseDir !== '') { diff --git a/lib/private/Files/Mount/LocalHomeMountProvider.php b/lib/private/Files/Mount/LocalHomeMountProvider.php index a2b3d3b2a99..daf4485fed6 100644 --- a/lib/private/Files/Mount/LocalHomeMountProvider.php +++ b/lib/private/Files/Mount/LocalHomeMountProvider.php @@ -15,13 +15,6 @@ use OCP\IUser; * Mount provider for regular posix home folders */ class LocalHomeMountProvider implements IHomeMountProvider { - /** - * Get the cache mount for a user - * - * @param IUser $user - * @param IStorageFactory $loader - * @return \OCP\Files\Mount\IMountPoint|null - */ public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { $arguments = ['user' => $user]; return new HomeMountPoint($user, '\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader, null, null, self::class); diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php index d118021afa2..2cf5b0b23b2 100644 --- a/lib/private/Files/Mount/Manager.php +++ b/lib/private/Files/Mount/Manager.php @@ -32,18 +32,12 @@ class Manager implements IMountManager { $this->setupManager = $setupManagerFactory->create($this); } - /** - * @param IMountPoint $mount - */ public function addMount(IMountPoint $mount) { $this->mounts[$mount->getMountPoint()] = $mount; $this->pathCache->clear(); $this->inPathCache->clear(); } - /** - * @param string $mountPoint - */ public function removeMount(string $mountPoint) { $mountPoint = Filesystem::normalizePath($mountPoint); if (\strlen($mountPoint) > 1) { @@ -54,10 +48,6 @@ class Manager implements IMountManager { $this->inPathCache->clear(); } - /** - * @param string $mountPoint - * @param string $target - */ public function moveMount(string $mountPoint, string $target) { $this->mounts[$target] = $this->mounts[$mountPoint]; unset($this->mounts[$mountPoint]); @@ -65,12 +55,6 @@ class Manager implements IMountManager { $this->inPathCache->clear(); } - /** - * Find the mount for $path - * - * @param string $path - * @return IMountPoint - */ public function find(string $path): IMountPoint { $this->setupManager->setupForPath($path); $path = Filesystem::normalizePath($path); @@ -107,12 +91,6 @@ class Manager implements IMountManager { throw new NotFoundException('No mount for path ' . $path . ' existing mounts (' . count($this->mounts) .'): ' . implode(',', array_keys($this->mounts))); } - /** - * Find all mounts in $path - * - * @param string $path - * @return IMountPoint[] - */ public function findIn(string $path): array { $this->setupManager->setupForPath($path, true); $path = $this->formatPath($path); @@ -140,12 +118,6 @@ class Manager implements IMountManager { $this->inPathCache->clear(); } - /** - * Find mounts by storage id - * - * @param string $id - * @return IMountPoint[] - */ public function findByStorageId(string $id): array { if (\strlen($id) > 64) { $id = md5($id); @@ -159,19 +131,10 @@ class Manager implements IMountManager { return $result; } - /** - * @return IMountPoint[] - */ public function getAll(): array { return $this->mounts; } - /** - * Find mounts by numeric storage id - * - * @param int $id - * @return IMountPoint[] - */ public function findByNumericId(int $id): array { $result = []; foreach ($this->mounts as $mount) { @@ -216,13 +179,6 @@ class Manager implements IMountManager { } } - /** - * Return the mount matching a cached mount info (or mount file info) - * - * @param ICachedMountInfo $info - * - * @return IMountPoint|null - */ public function getMountFromMountInfo(ICachedMountInfo $info): ?IMountPoint { $this->setupManager->setupForPath($info->getMountPoint()); foreach ($this->mounts as $mount) { diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php index cb3a3e8a22d..a71855a5f92 100644 --- a/lib/private/Files/Mount/MountPoint.php +++ b/lib/private/Files/Mount/MountPoint.php @@ -112,20 +112,10 @@ class MountPoint implements IMountPoint { $this->mountProvider = $mountProvider ?? ''; } - /** - * get complete path to the mount point, relative to data/ - * - * @return string - */ public function getMountPoint() { return $this->mountPoint; } - /** - * Sets the mount point path, relative to data/ - * - * @param string $mountPoint new mount point - */ public function setMountPoint($mountPoint) { $this->mountPoint = $this->formatPath($mountPoint); } @@ -162,9 +152,6 @@ class MountPoint implements IMountPoint { } } - /** - * @return \OC\Files\Storage\Storage|null - */ public function getStorage() { if (is_null($this->storage)) { $this->createStorage(); @@ -172,9 +159,6 @@ class MountPoint implements IMountPoint { return $this->storage; } - /** - * @return string|null - */ public function getStorageId() { if (!$this->storageId) { $storage = $this->getStorage(); @@ -189,9 +173,6 @@ class MountPoint implements IMountPoint { return $this->storageId; } - /** - * @return int - */ public function getNumericStorageId() { if (is_null($this->numericStorageId)) { $storage = $this->getStorage(); @@ -203,10 +184,6 @@ class MountPoint implements IMountPoint { return $this->numericStorageId; } - /** - * @param string $path - * @return string - */ public function getInternalPath($path) { $path = Filesystem::normalizePath($path, true, false, true); if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) { @@ -230,9 +207,6 @@ class MountPoint implements IMountPoint { return $path; } - /** - * @param callable $wrapper - */ public function wrapStorage($wrapper) { $storage = $this->getStorage(); // storage can be null if it couldn't be initialized @@ -241,31 +215,14 @@ class MountPoint implements IMountPoint { } } - /** - * Get a mount option - * - * @param string $name Name of the mount option to get - * @param mixed $default Default value for the mount option - * @return mixed - */ public function getOption($name, $default) { return $this->mountOptions[$name] ?? $default; } - /** - * Get all options for the mount - * - * @return array - */ public function getOptions() { return $this->mountOptions; } - /** - * Get the file id of the root of the storage - * - * @return int - */ public function getStorageRootId() { if (is_null($this->rootId) || $this->rootId === -1) { $storage = $this->getStorage(); diff --git a/lib/private/Files/Mount/ObjectHomeMountProvider.php b/lib/private/Files/Mount/ObjectHomeMountProvider.php index 99c52108fa8..5b37b86733b 100644 --- a/lib/private/Files/Mount/ObjectHomeMountProvider.php +++ b/lib/private/Files/Mount/ObjectHomeMountProvider.php @@ -31,13 +31,6 @@ class ObjectHomeMountProvider implements IHomeMountProvider { $this->config = $config; } - /** - * Get the cache mount for a user - * - * @param IUser $user - * @param IStorageFactory $loader - * @return \OCP\Files\Mount\IMountPoint - */ public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { $config = $this->getMultiBucketObjectStoreConfig($user); if ($config === null) { diff --git a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php index 1546ef98f50..b6e24b0e4df 100644 --- a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php +++ b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php @@ -29,10 +29,6 @@ class ObjectStorePreviewCacheMountProvider implements IRootMountProvider { $this->config = $config; } - /** - * @return MountPoint[] - * @throws \Exception - */ public function getRootMounts(IStorageFactory $loader): array { if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) { return []; diff --git a/lib/private/Files/Node/File.php b/lib/private/Files/Node/File.php index eb6411d7d13..9ee6e90ede7 100644 --- a/lib/private/Files/Node/File.php +++ b/lib/private/Files/Node/File.php @@ -9,7 +9,6 @@ namespace OC\Files\Node; use OCP\Files\GenericFileException; use OCP\Files\NotPermittedException; -use OCP\Lock\LockedException; class File extends Node implements \OCP\Files\File { /** @@ -22,12 +21,6 @@ class File extends Node implements \OCP\Files\File { return new NonExistingFile($this->root, $this->view, $path); } - /** - * @return string - * @throws NotPermittedException - * @throws GenericFileException - * @throws LockedException - */ public function getContent() { if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) { $content = $this->view->file_get_contents($this->path); @@ -40,12 +33,6 @@ class File extends Node implements \OCP\Files\File { } } - /** - * @param string|resource $data - * @throws NotPermittedException - * @throws GenericFileException - * @throws LockedException - */ public function putContent($data) { if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) { $this->sendHooks(['preWrite']); @@ -59,12 +46,6 @@ class File extends Node implements \OCP\Files\File { } } - /** - * @param string $mode - * @return resource|false - * @throws NotPermittedException - * @throws LockedException - */ public function fopen($mode) { $preHooks = []; $postHooks = []; @@ -100,11 +81,6 @@ class File extends Node implements \OCP\Files\File { } } - /** - * @throws NotPermittedException - * @throws \OCP\Files\InvalidPathException - * @throws \OCP\Files\NotFoundException - */ public function delete() { if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) { $this->sendHooks(['preDelete']); @@ -118,18 +94,10 @@ class File extends Node implements \OCP\Files\File { } } - /** - * @param string $type - * @param bool $raw - * @return string - */ public function hash($type, $raw = false) { return $this->view->hash($type, $this->path, $raw); } - /** - * @inheritdoc - */ public function getChecksum() { return $this->getFileInfo()->getChecksum(); } diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index ca256b09d33..2302b57f052 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -40,11 +40,6 @@ class Folder extends Node implements \OCP\Files\Folder { return new NonExistingFolder($this->root, $this->view, $path); } - /** - * @param string $path path relative to the folder - * @return string - * @throws \OCP\Files\NotPermittedException - */ public function getFullPath($path) { $path = $this->normalizePath($path); if (!$this->isValidPath($path)) { @@ -53,30 +48,14 @@ class Folder extends Node implements \OCP\Files\Folder { return $this->path . $path; } - /** - * @param string $path - * @return string|null - */ public function getRelativePath($path) { return PathHelper::getRelativePath($this->getPath(), $path); } - /** - * check if a node is a (grand-)child of the folder - * - * @param \OC\Files\Node\Node $node - * @return bool - */ public function isSubNode($node) { return str_starts_with($node->getPath(), $this->path . '/'); } - /** - * get the content of this directory - * - * @return Node[] - * @throws \OCP\Files\NotFoundException - */ public function getDirectoryListing() { $folderContent = $this->view->getDirectoryContent($this->path, '', $this->getFileInfo(false)); @@ -103,21 +82,10 @@ class Folder extends Node implements \OCP\Files\Folder { } } - /** - * Get the node at $path - * - * @param string $path - * @return \OC\Files\Node\Node - * @throws \OCP\Files\NotFoundException - */ public function get($path) { return $this->root->get($this->getFullPath($path)); } - /** - * @param string $path - * @return bool - */ public function nodeExists($path) { try { $this->get($path); @@ -127,11 +95,6 @@ class Folder extends Node implements \OCP\Files\Folder { } } - /** - * @param string $path - * @return \OC\Files\Node\Folder - * @throws \OCP\Files\NotPermittedException - */ public function newFolder($path) { if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) { $fullPath = $this->getFullPath($path); @@ -149,12 +112,6 @@ class Folder extends Node implements \OCP\Files\Folder { } } - /** - * @param string $path - * @param string | resource | null $content - * @return \OC\Files\Node\File - * @throws \OCP\Files\NotPermittedException - */ public function newFile($path, $content = null) { if ($path === '') { throw new NotPermittedException('Could not create as provided path is empty'); @@ -189,12 +146,6 @@ class Folder extends Node implements \OCP\Files\Folder { return new SearchQuery($operator, $limit, $offset, [], $user); } - /** - * search for files with the name matching $query - * - * @param string|ISearchQuery $query - * @return \OC\Files\Node\Node[] - */ public function search($query) { if (is_string($query)) { $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%')); @@ -271,12 +222,6 @@ class Folder extends Node implements \OCP\Files\Folder { ); } - /** - * search for files by mimetype - * - * @param string $mimetype - * @return Node[] - */ public function searchByMime($mimetype) { if (!str_contains($mimetype, '/')) { $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%')); @@ -286,13 +231,6 @@ class Folder extends Node implements \OCP\Files\Folder { return $this->search($query); } - /** - * search for files by tag - * - * @param string|int $tag name or tag id - * @param string $userId owner of the tags - * @return Node[] - */ public function searchByTag($tag, $userId) { $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'tagname', $tag), $userId); return $this->search($query); @@ -303,10 +241,6 @@ class Folder extends Node implements \OCP\Files\Folder { return $this->search($query); } - /** - * @param int $id - * @return \OCP\Files\Node[] - */ public function getById($id) { return $this->root->getByIdInPath((int)$id, $this->getPath()); } @@ -379,23 +313,11 @@ class Folder extends Node implements \OCP\Files\Folder { } } - /** - * Add a suffix to the name in case the file exists - * - * @param string $name - * @return string - * @throws NotPermittedException - */ public function getNonExistingName($name) { $uniqueName = \OC_Helper::buildNotExistingFileNameForView($this->getPath(), $name, $this->view); return trim($this->getRelativePath($uniqueName), '/'); } - /** - * @param int $limit - * @param int $offset - * @return INode[] - */ public function getRecent($limit, $offset = 0) { $filterOutNonEmptyFolder = new SearchBinaryOperator( // filter out non empty folders diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index 83ed7e534a7..028368483fe 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -134,9 +134,6 @@ class LazyFolder implements Folder { $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function get($path) { return $this->getRootFolder()->get($this->getFullPath($path)); } @@ -148,37 +145,22 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function delete() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function copy($targetPath) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function touch($mtime = null) { $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getStorage() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getPath() { if (isset($this->data['path'])) { return $this->data['path']; @@ -186,16 +168,10 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getInternalPath() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getId() { if (isset($this->data['fileid'])) { return $this->data['fileid']; @@ -203,16 +179,10 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function stat() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getMTime() { if (isset($this->data['mtime'])) { return $this->data['mtime']; @@ -220,9 +190,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getSize($includeMounts = true): int|float { if (isset($this->data['size'])) { return $this->data['size']; @@ -230,9 +197,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getEtag() { if (isset($this->data['etag'])) { return $this->data['etag']; @@ -240,9 +204,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getPermissions() { if (isset($this->data['permissions'])) { return $this->data['permissions']; @@ -250,9 +211,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isReadable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_READ) == Constants::PERMISSION_READ; @@ -260,9 +218,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isUpdateable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_UPDATE) == Constants::PERMISSION_UPDATE; @@ -270,9 +225,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isDeletable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_DELETE) == Constants::PERMISSION_DELETE; @@ -280,9 +232,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isShareable() { if (isset($this->data['permissions'])) { return ($this->data['permissions'] & Constants::PERMISSION_SHARE) == Constants::PERMISSION_SHARE; @@ -290,16 +239,10 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getParent() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getName() { if (isset($this->data['path'])) { return basename($this->data['path']); @@ -317,9 +260,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getMimetype() { if (isset($this->data['mimetype'])) { return $this->data['mimetype']; @@ -327,9 +267,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getMimePart() { if (isset($this->data['mimetype'])) { [$part,] = explode('/', $this->data['mimetype']); @@ -338,16 +275,10 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isEncrypted() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getType() { if (isset($this->data['type'])) { return $this->data['type']; @@ -355,37 +286,22 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isShared() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isMounted() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getMountPoint() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getOwner() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getChecksum() { return $this->__call(__FUNCTION__, func_get_args()); } @@ -394,9 +310,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getFullPath($path) { if (isset($this->data['path'])) { $path = PathHelper::normalizePath($path); @@ -408,58 +321,34 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isSubNode($node) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getDirectoryListing() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function nodeExists($path) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function newFolder($path) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function newFile($path, $content = null) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function search($query) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function searchByMime($mimetype) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function searchByTag($tag, $userId) { return $this->__call(__FUNCTION__, func_get_args()); } @@ -468,9 +357,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getById($id) { return $this->getRootFolder()->getByIdInPath((int)$id, $this->getPath()); } @@ -479,72 +365,42 @@ class LazyFolder implements Folder { return $this->getRootFolder()->getFirstNodeByIdInPath($id, $this->getPath()); } - /** - * @inheritDoc - */ public function getFreeSpace() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function isCreatable() { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getNonExistingName($name) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function move($targetPath) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function lock($type) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function changeLock($targetType) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function unlock($type) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getRecent($limit, $offset = 0) { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getCreationTime(): int { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - */ public function getUploadTime(): int { return $this->__call(__FUNCTION__, func_get_args()); } @@ -560,10 +416,6 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } - /** - * @inheritDoc - * @return array<string, int|string|bool|float|string[]|int[]> - */ public function getMetadata(): array { return $this->data['metadata'] ?? $this->__call(__FUNCTION__, func_get_args()); } diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 5dbdc4054bf..66c74a8158e 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -18,7 +18,6 @@ use OCP\Files\IRootFolder; use OCP\Files\Node as INode; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; -use OCP\Lock\LockedException; use OCP\PreConditionNotMetException; // FIXME: this class really should be abstract (+1) @@ -133,12 +132,6 @@ class Node implements INode { public function delete() { } - /** - * @param int $mtime - * @throws InvalidPathException - * @throws NotFoundException - * @throws NotPermittedException - */ public function touch($mtime = null) { if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) { $this->sendHooks(['preTouch']); @@ -163,114 +156,54 @@ class Node implements INode { return $storage; } - /** - * @return string - */ public function getPath() { return $this->path; } - /** - * @return string - */ public function getInternalPath() { return $this->getFileInfo(false)->getInternalPath(); } - /** - * @return int - * @throws InvalidPathException - * @throws NotFoundException - */ public function getId() { return $this->getFileInfo(false)->getId() ?? -1; } - /** - * @return array - */ public function stat() { return $this->view->stat($this->path); } - /** - * @return int - * @throws InvalidPathException - * @throws NotFoundException - */ public function getMTime() { return $this->getFileInfo()->getMTime(); } - /** - * @param bool $includeMounts - * @return int|float - * @throws InvalidPathException - * @throws NotFoundException - */ public function getSize($includeMounts = true): int|float { return $this->getFileInfo()->getSize($includeMounts); } - /** - * @return string - * @throws InvalidPathException - * @throws NotFoundException - */ public function getEtag() { return $this->getFileInfo()->getEtag(); } - /** - * @return int - * @throws InvalidPathException - * @throws NotFoundException - */ public function getPermissions() { return $this->getFileInfo(false)->getPermissions(); } - /** - * @return bool - * @throws InvalidPathException - * @throws NotFoundException - */ public function isReadable() { return $this->getFileInfo(false)->isReadable(); } - /** - * @return bool - * @throws InvalidPathException - * @throws NotFoundException - */ public function isUpdateable() { return $this->getFileInfo(false)->isUpdateable(); } - /** - * @return bool - * @throws InvalidPathException - * @throws NotFoundException - */ public function isDeletable() { return $this->getFileInfo(false)->isDeletable(); } - /** - * @return bool - * @throws InvalidPathException - * @throws NotFoundException - */ public function isShareable() { return $this->getFileInfo(false)->isShareable(); } - /** - * @return bool - * @throws InvalidPathException - * @throws NotFoundException - */ public function isCreatable() { return $this->getFileInfo(false)->isCreatable(); } @@ -306,9 +239,6 @@ class Node implements INode { return $this->parent; } - /** - * @return string - */ public function getName() { return basename($this->path); } @@ -370,37 +300,18 @@ class Node implements INode { return $this->getFileInfo(false)->getExtension(); } - /** - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @throws LockedException - */ public function lock($type) { $this->view->lockFile($this->path, $type); } - /** - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @throws LockedException - */ public function changeLock($type) { $this->view->changeLock($this->path, $type); } - /** - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @throws LockedException - */ public function unlock($type) { $this->view->unlockFile($this->path, $type); } - /** - * @param string $targetPath - * @return INode - * @throws InvalidPathException - * @throws NotFoundException - * @throws NotPermittedException if copy not allowed or failed - */ public function copy($targetPath) { $targetPath = $this->normalizePath($targetPath); $parent = $this->root->get(dirname($targetPath)); @@ -420,14 +331,6 @@ class Node implements INode { } } - /** - * @param string $targetPath - * @return INode - * @throws InvalidPathException - * @throws NotFoundException - * @throws NotPermittedException if move not allowed or failed - * @throws LockedException - */ public function move($targetPath) { $targetPath = $this->normalizePath($targetPath); $parent = $this->root->get(dirname($targetPath)); @@ -479,10 +382,6 @@ class Node implements INode { return $this->fileInfo->getParentId(); } - /** - * @inheritDoc - * @return array<string, int|string|bool|float|string[]|int[]> - */ public function getMetadata(): array { return $this->fileInfo->getMetadata(); } diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index 416adc7f374..755167f0eb4 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -98,20 +98,10 @@ class Root extends Folder implements IRootFolder { return $this->user; } - /** - * @param string $scope - * @param string $method - * @param callable $callback - */ public function listen($scope, $method, callable $callback) { $this->emitter->listen($scope, $method, $callback); } - /** - * @param string $scope optional - * @param string $method optional - * @param callable $callback optional - */ public function removeListener($scope = null, $method = null, ?callable $callback = null) { $this->emitter->removeListener($scope, $method, $callback); } @@ -139,10 +129,6 @@ class Root extends Folder implements IRootFolder { return $this->mountManager->find($mountPoint); } - /** - * @param string $mountPoint - * @return \OC\Files\Mount\MountPoint[] - */ public function getMountsIn(string $mountPoint): array { return $this->mountManager->findIn($mountPoint); } @@ -170,12 +156,6 @@ class Root extends Folder implements IRootFolder { $this->mountManager->remove($mount); } - /** - * @param string $path - * @return Node - * @throws \OCP\Files\NotPermittedException - * @throws \OCP\Files\NotFoundException - */ public function get($path) { $path = $this->normalizePath($path); if ($this->isValidPath($path)) { @@ -206,138 +186,74 @@ class Root extends Folder implements IRootFolder { throw new NotPermittedException(); } - /** - * @param string $targetPath - * @return Node - * @throws \OCP\Files\NotPermittedException - */ public function copy($targetPath) { throw new NotPermittedException(); } - /** - * @param int $mtime - * @throws \OCP\Files\NotPermittedException - */ public function touch($mtime = null) { throw new NotPermittedException(); } - /** - * @return \OC\Files\Storage\Storage - * @throws \OCP\Files\NotFoundException - */ public function getStorage() { throw new NotFoundException(); } - /** - * @return string - */ public function getPath() { return '/'; } - /** - * @return string - */ public function getInternalPath() { return ''; } - /** - * @return int - */ public function getId() { return 0; } - /** - * @return array - */ public function stat() { return []; } - /** - * @return int - */ public function getMTime() { return 0; } - /** - * @param bool $includeMounts - * @return int|float - */ public function getSize($includeMounts = true): int|float { return 0; } - /** - * @return string - */ public function getEtag() { return ''; } - /** - * @return int - */ public function getPermissions() { return \OCP\Constants::PERMISSION_CREATE; } - /** - * @return bool - */ public function isReadable() { return false; } - /** - * @return bool - */ public function isUpdateable() { return false; } - /** - * @return bool - */ public function isDeletable() { return false; } - /** - * @return bool - */ public function isShareable() { return false; } - /** - * @throws \OCP\Files\NotFoundException - */ public function getParent(): INode|IRootFolder { throw new NotFoundException(); } - /** - * @return string - */ public function getName() { return ''; } - /** - * Returns a view to user's files folder - * - * @param string $userId user ID - * @return \OCP\Files\Folder - * @throws NoUserException - * @throws NotPermittedException - */ public function getUserFolder($userId) { $userObject = $this->userManager->get($userId); @@ -410,10 +326,6 @@ class Root extends Folder implements IRootFolder { return $node; } - /** - * @param int $id - * @return Node[] - */ public function getByIdInPath(int $id, string $path): array { $mountCache = $this->getUserMountCache(); if (strpos($path, '/', 1) > 0) { diff --git a/lib/private/Files/Notify/Change.php b/lib/private/Files/Notify/Change.php index d2448e5deec..cbffffc75ef 100644 --- a/lib/private/Files/Notify/Change.php +++ b/lib/private/Files/Notify/Change.php @@ -25,22 +25,10 @@ class Change implements IChange { $this->path = $path; } - /** - * Get the type of the change - * - * @return int IChange::ADDED, IChange::REMOVED, IChange::MODIFIED or IChange::RENAMED - */ public function getType() { return $this->type; } - /** - * Get the path of the file that was changed relative to the root of the storage - * - * Note, for rename changes this path is the old path for the file - * - * @return mixed - */ public function getPath() { return $this->path; } diff --git a/lib/private/Files/Notify/RenameChange.php b/lib/private/Files/Notify/RenameChange.php index 98fd7099a58..ab3bfe1b7ef 100644 --- a/lib/private/Files/Notify/RenameChange.php +++ b/lib/private/Files/Notify/RenameChange.php @@ -23,11 +23,6 @@ class RenameChange extends Change implements IRenameChange { $this->targetPath = $targetPath; } - /** - * Get the new path of the renamed file relative to the storage root - * - * @return string - */ public function getTargetPath() { return $this->targetPath; } diff --git a/lib/private/Files/ObjectStore/Azure.php b/lib/private/Files/ObjectStore/Azure.php index 2dacdac1f8d..9359289da04 100644 --- a/lib/private/Files/ObjectStore/Azure.php +++ b/lib/private/Files/ObjectStore/Azure.php @@ -66,18 +66,10 @@ class Azure implements IObjectStore { return $this->blobClient; } - /** - * @return string the container or bucket name where objects are stored - */ public function getStorageId() { return 'azure::blob::' . $this->containerName; } - /** - * @param string $urn the unified resource name used to identify the object - * @return resource stream with the read data - * @throws \Exception when something goes wrong, message will be logged - */ public function readObject($urn) { $blob = $this->getBlobClient()->getBlob($this->containerName, $urn); return $blob->getContentStream(); @@ -91,11 +83,6 @@ class Azure implements IObjectStore { $this->getBlobClient()->createBlockBlob($this->containerName, $urn, $stream, $options); } - /** - * @param string $urn the unified resource name used to identify the object - * @return void - * @throws \Exception when something goes wrong, message will be logged - */ public function deleteObject($urn) { $this->getBlobClient()->deleteBlob($this->containerName, $urn); } diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index b543d223f4c..daf6b5c83c9 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -14,12 +14,6 @@ use OCP\IUser; class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage { protected IUser $user; - /** - * The home user storage requires a user object to create a unique storage id - * - * @param array $params - * @throws Exception - */ public function __construct($params) { if (! isset($params['user']) || ! $params['user'] instanceof IUser) { throw new Exception('missing user object in parameters'); @@ -32,12 +26,6 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage return 'object::user:' . $this->user->getUID(); } - /** - * get the owner of a path - * - * @param string $path The path to get the owner - * @return string uid - */ public function getOwner($path): string { return $this->user->getUID(); } diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 228fc516677..8465ccede9d 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -38,10 +38,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil private bool $handleCopiesAsOwned; protected bool $validateWrites = true; - /** - * @param array $params - * @throws \Exception - */ public function __construct($params) { if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) { $this->objectStore = $params['objectstore']; @@ -126,14 +122,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return $path; } - /** - * Object Stores use a NoopScanner because metadata is directly stored in - * the file cache and cannot really scan the filesystem. The storage passed in is not used anywhere. - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\ObjectStore\ObjectStoreScanner - */ public function getScanner($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -446,13 +434,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $this->writeStream($path, fopen($tmpFile, 'r'), $size); } - /** - * external changes are not supported, exclusive access to the object storage is assumed - * - * @param string $path - * @param int $time - * @return false - */ public function hasUpdated($path, $time) { return false; } @@ -686,10 +667,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil return $this->objectStore->initiateMultipartUpload($urn); } - /** - * - * @throws GenericFileException - */ public function putChunkedWritePart( string $targetPath, string $writeToken, diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php index 72c19d951e4..63f2e53b5a8 100644 --- a/lib/private/Files/ObjectStore/S3.php +++ b/lib/private/Files/ObjectStore/S3.php @@ -19,10 +19,6 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { $this->parseParams($parameters); } - /** - * @return string the container or bucket name where objects are stored - * @since 7.0.0 - */ public function getStorageId() { return $this->id; } diff --git a/lib/private/Files/ObjectStore/StorageObjectStore.php b/lib/private/Files/ObjectStore/StorageObjectStore.php index 5e7125e18a6..56f950dc09e 100644 --- a/lib/private/Files/ObjectStore/StorageObjectStore.php +++ b/lib/private/Files/ObjectStore/StorageObjectStore.php @@ -23,20 +23,10 @@ class StorageObjectStore implements IObjectStore { $this->storage = $storage; } - /** - * @return string the container or bucket name where objects are stored - * @since 7.0.0 - */ public function getStorageId() { $this->storage->getId(); } - /** - * @param string $urn the unified resource name used to identify the object - * @return resource stream with the read data - * @throws \Exception when something goes wrong, message will be logged - * @since 7.0.0 - */ public function readObject($urn) { $handle = $this->storage->fopen($urn, 'r'); if (is_resource($handle)) { @@ -56,12 +46,6 @@ class StorageObjectStore implements IObjectStore { } } - /** - * @param string $urn the unified resource name used to identify the object - * @return void - * @throws \Exception when something goes wrong, message will be logged - * @since 7.0.0 - */ public function deleteObject($urn) { $this->storage->unlink($urn); } diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php index aa8b3bb34ec..857b9674a2c 100644 --- a/lib/private/Files/ObjectStore/Swift.php +++ b/lib/private/Files/ObjectStore/Swift.php @@ -45,9 +45,6 @@ class Swift implements IObjectStore { return $this->swiftFactory->getContainer(); } - /** - * @return string the container name where objects are stored - */ public function getStorageId() { if (isset($this->params['bucket'])) { return $this->params['bucket']; @@ -77,12 +74,6 @@ class Swift implements IObjectStore { } } - /** - * @param string $urn the unified resource name used to identify the object - * @return resource stream with the read data - * @throws \Exception from openstack or GuzzleHttp libs when something goes wrong - * @throws NotFoundException if file does not exist - */ public function readObject($urn) { try { $publicUri = $this->getContainer()->getObject($urn)->getPublicUri(); @@ -108,11 +99,6 @@ class Swift implements IObjectStore { return RetryWrapper::wrap($response->getBody()->detach()); } - /** - * @param string $urn Unified Resource Name - * @return void - * @throws \Exception from openstack lib when something goes wrong - */ public function deleteObject($urn) { $this->getContainer()->getObject($urn)->delete(); } diff --git a/lib/private/Files/Search/SearchBinaryOperator.php b/lib/private/Files/Search/SearchBinaryOperator.php index 59a1ba2dfaf..d4ef19aad33 100644 --- a/lib/private/Files/Search/SearchBinaryOperator.php +++ b/lib/private/Files/Search/SearchBinaryOperator.php @@ -26,16 +26,10 @@ class SearchBinaryOperator implements ISearchBinaryOperator { $this->arguments = $arguments; } - /** - * @return string - */ public function getType() { return $this->type; } - /** - * @return ISearchOperator[] - */ public function getArguments() { return $this->arguments; } diff --git a/lib/private/Files/Search/SearchComparison.php b/lib/private/Files/Search/SearchComparison.php index e3a8f800506..e648f34d804 100644 --- a/lib/private/Files/Search/SearchComparison.php +++ b/lib/private/Files/Search/SearchComparison.php @@ -24,16 +24,10 @@ class SearchComparison implements ISearchComparison { ) { } - /** - * @return string - */ public function getType(): string { return $this->type; } - /** - * @return string - */ public function getField(): string { return $this->field; } @@ -42,10 +36,6 @@ class SearchComparison implements ISearchComparison { return $this->value; } - /** - * @return string - * @since 28.0.0 - */ public function getExtra(): string { return $this->extra; } diff --git a/lib/private/Files/Search/SearchOrder.php b/lib/private/Files/Search/SearchOrder.php index f3f62b933a1..aa34325346c 100644 --- a/lib/private/Files/Search/SearchOrder.php +++ b/lib/private/Files/Search/SearchOrder.php @@ -16,24 +16,14 @@ class SearchOrder implements ISearchOrder { ) { } - /** - * @return string - */ public function getDirection(): string { return $this->direction; } - /** - * @return string - */ public function getField(): string { return $this->field; } - /** - * @return string - * @since 28.0.0 - */ public function getExtra(): string { return $this->extra; } diff --git a/lib/private/Files/Search/SearchQuery.php b/lib/private/Files/Search/SearchQuery.php index 3c8711facd8..fe868be726a 100644 --- a/lib/private/Files/Search/SearchQuery.php +++ b/lib/private/Files/Search/SearchQuery.php @@ -49,37 +49,22 @@ class SearchQuery implements ISearchQuery { $this->limitToHome = $limitToHome; } - /** - * @return ISearchOperator - */ public function getSearchOperation() { return $this->searchOperation; } - /** - * @return int - */ public function getLimit() { return $this->limit; } - /** - * @return int - */ public function getOffset() { return $this->offset; } - /** - * @return ISearchOrder[] - */ public function getOrder() { return $this->order; } - /** - * @return ?IUser - */ public function getUser() { return $this->user; } diff --git a/lib/private/Files/SimpleFS/NewSimpleFile.php b/lib/private/Files/SimpleFS/NewSimpleFile.php index d0986592c03..a6cc5289dda 100644 --- a/lib/private/Files/SimpleFS/NewSimpleFile.php +++ b/lib/private/Files/SimpleFS/NewSimpleFile.php @@ -12,7 +12,6 @@ use Icewind\Streams\CallbackWrapper; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\NotFoundException; -use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFile; class NewSimpleFile implements ISimpleFile { @@ -28,16 +27,10 @@ class NewSimpleFile implements ISimpleFile { $this->name = $name; } - /** - * Get the name - */ public function getName(): string { return $this->name; } - /** - * Get the size in bytes - */ public function getSize(): int|float { if ($this->file) { return $this->file->getSize(); @@ -46,9 +39,6 @@ class NewSimpleFile implements ISimpleFile { } } - /** - * Get the ETag - */ public function getETag(): string { if ($this->file) { return $this->file->getEtag(); @@ -57,9 +47,6 @@ class NewSimpleFile implements ISimpleFile { } } - /** - * Get the last modification time - */ public function getMTime(): int { if ($this->file) { return $this->file->getMTime(); @@ -68,12 +55,6 @@ class NewSimpleFile implements ISimpleFile { } } - /** - * Get the content - * - * @throws NotFoundException - * @throws NotPermittedException - */ public function getContent(): string { if ($this->file) { $result = $this->file->getContent(); @@ -88,13 +69,6 @@ class NewSimpleFile implements ISimpleFile { } } - /** - * Overwrite the file - * - * @param string|resource $data - * @throws NotPermittedException - * @throws NotFoundException - */ public function putContent($data): void { try { if ($this->file) { @@ -140,22 +114,12 @@ class NewSimpleFile implements ISimpleFile { } - /** - * Delete the file - * - * @throws NotPermittedException - */ public function delete(): void { if ($this->file) { $this->file->delete(); } } - /** - * Get the MimeType - * - * @return string - */ public function getMimeType(): string { if ($this->file) { return $this->file->getMimeType(); @@ -164,9 +128,6 @@ class NewSimpleFile implements ISimpleFile { } } - /** - * {@inheritDoc} - */ public function getExtension(): string { if ($this->file) { return $this->file->getExtension(); @@ -175,13 +136,6 @@ class NewSimpleFile implements ISimpleFile { } } - /** - * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen - * - * @return resource|false - * @throws \OCP\Files\NotPermittedException - * @since 14.0.0 - */ public function read() { if ($this->file) { return $this->file->fopen('r'); @@ -190,13 +144,6 @@ class NewSimpleFile implements ISimpleFile { } } - /** - * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen - * - * @return resource|bool - * @throws \OCP\Files\NotPermittedException - * @since 14.0.0 - */ public function write() { if ($this->file) { return $this->file->fopen('w'); diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php index cbb3af4db29..b69df95e0ae 100644 --- a/lib/private/Files/SimpleFS/SimpleFile.php +++ b/lib/private/Files/SimpleFS/SimpleFile.php @@ -7,7 +7,6 @@ namespace OC\Files\SimpleFS; use OCP\Files\File; use OCP\Files\NotFoundException; -use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFile; class SimpleFile implements ISimpleFile { @@ -17,40 +16,22 @@ class SimpleFile implements ISimpleFile { $this->file = $file; } - /** - * Get the name - */ public function getName(): string { return $this->file->getName(); } - /** - * Get the size in bytes - */ public function getSize(): int|float { return $this->file->getSize(); } - /** - * Get the ETag - */ public function getETag(): string { return $this->file->getEtag(); } - /** - * Get the last modification time - */ public function getMTime(): int { return $this->file->getMTime(); } - /** - * Get the content - * - * @throws NotPermittedException - * @throws NotFoundException - */ public function getContent(): string { $result = $this->file->getContent(); @@ -61,13 +42,6 @@ class SimpleFile implements ISimpleFile { return $result; } - /** - * Overwrite the file - * - * @param string|resource $data - * @throws NotPermittedException - * @throws NotFoundException - */ public function putContent($data): void { try { $this->file->putContent($data); @@ -105,47 +79,22 @@ class SimpleFile implements ISimpleFile { } - /** - * Delete the file - * - * @throws NotPermittedException - */ public function delete(): void { $this->file->delete(); } - /** - * Get the MimeType - */ public function getMimeType(): string { return $this->file->getMimeType(); } - /** - * {@inheritDoc} - */ public function getExtension(): string { return $this->file->getExtension(); } - /** - * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen - * - * @return resource|false - * @throws \OCP\Files\NotPermittedException - * @since 14.0.0 - */ public function read() { return $this->file->fopen('r'); } - /** - * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen - * - * @return resource|false - * @throws \OCP\Files\NotPermittedException - * @since 14.0.0 - */ public function write() { return $this->file->fopen('w'); } diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index cefba66683b..bdfe6b3b0c1 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -286,18 +286,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $files; } - /** - * Check if a file or folder has been updated since $time - * - * The method is only used to check if the cache needs to be updated. Storage backends that don't support checking - * the mtime should always return false here. As a result storage implementations that always return false expect - * exclusive access to the backend and will not pick up files that have been added in a way that circumvents - * Nextcloud filesystem. - * - * @param string $path - * @param int $time - * @return bool - */ public function hasUpdated($path, $time) { return $this->filemtime($path) > $time; } @@ -342,12 +330,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->watcher; } - /** - * get a propagator instance for the cache - * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Propagator - */ public function getPropagator($storage = null) { if (!$storage) { $storage = $this; @@ -373,12 +355,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->getCache($storage)->getStorageCache(); } - /** - * get the owner of a path - * - * @param string $path The path to get the owner - * @return string|false uid or false - */ public function getOwner($path) { if ($this->owner === null) { $this->owner = \OC_User::getUser(); @@ -387,12 +363,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->owner; } - /** - * get the ETag for a file or folder - * - * @param string $path - * @return string|false - */ public function getETag($path) { return uniqid(); } @@ -421,11 +391,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return implode('/', $output); } - /** - * Test a storage for availability - * - * @return bool - */ public function test() { try { if ($this->stat('')) { @@ -442,31 +407,16 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } } - /** - * get the free space in the storage - * - * @param string $path - * @return int|float|false - */ public function free_space($path) { return \OCP\Files\FileInfo::SPACE_UNKNOWN; } - /** - * {@inheritdoc} - */ public function isLocal() { // the common implementation returns a temporary file by // default, which is not local return false; } - /** - * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class - * - * @param string $class - * @return bool - */ public function instanceOfStorage($class) { if (ltrim($class, '\\') === 'OC\Files\Storage\Shared') { // FIXME Temporary fix to keep existing checks working @@ -475,22 +425,10 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return is_a($this, $class); } - /** - * A custom storage implementation can return an url for direct download of a give file. - * - * For now the returned array can hold the parameter url - in future more attributes might follow. - * - * @param string $path - * @return array|false - */ public function getDirectDownload($path) { return []; } - /** - * @inheritdoc - * @throws InvalidPathException - */ public function verifyPath($path, $fileName) { $this->getFilenameValidator() ->validateFilename($fileName); @@ -536,13 +474,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->mountOptions[$name] ?? $default; } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @param bool $preserveMtime - * @return bool - */ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); @@ -603,12 +534,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $storage === $this; } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($this->isSameStorage($sourceStorage)) { // resolve any jailed paths @@ -671,12 +596,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $data; } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function acquireLock($path, $type, ILockingProvider $provider) { $logger = $this->getLockLogger(); if ($logger) { @@ -704,12 +623,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function releaseLock($path, $type, ILockingProvider $provider) { $logger = $this->getLockLogger(); if ($logger) { @@ -737,12 +650,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function changeLock($path, $type, ILockingProvider $provider) { $logger = $this->getLockLogger(); if ($logger) { @@ -778,29 +685,14 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return $this->logger; } - /** - * @return array [ available, last_checked ] - */ public function getAvailability() { return $this->getStorageCache()->getAvailability(); } - /** - * @param bool $isAvailable - */ public function setAvailability($isAvailable) { $this->getStorageCache()->setAvailability($isAvailable); } - /** - * Allow setting the storage owner - * - * This can be used for storages that do not have a dedicated owner, where we want to - * pass the user that we setup the mountpoint for along to the storage layer - * - * @param string|null $user - * @return void - */ public function setOwner(?string $user): void { $this->owner = $user; } @@ -812,14 +704,6 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { return true; } - /** - * fallback implementation - * - * @param string $path - * @param resource $stream - * @param int $size - * @return int - */ public function writeStream(string $path, $stream, ?int $size = null): int { $target = $this->fopen($path, 'w'); if (!$target) { diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index a8d1f82b987..391042306dc 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -24,12 +24,6 @@ class Home extends Local implements \OCP\Files\IHomeStorage { */ protected $user; - /** - * Construct a Home storage instance - * - * @param array $arguments array with "user" containing the - * storage owner - */ public function __construct($arguments) { $this->user = $arguments['user']; $datadir = $this->user->getHome(); @@ -42,9 +36,6 @@ class Home extends Local implements \OCP\Files\IHomeStorage { return $this->id; } - /** - * @return \OC\Files\Cache\HomeCache - */ public function getCache($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -55,12 +46,6 @@ class Home extends Local implements \OCP\Files\IHomeStorage { return $this->cache; } - /** - * get a propagator instance for the cache - * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Propagator - */ public function getPropagator($storage = null) { if (!$storage) { $storage = $this; @@ -72,21 +57,10 @@ class Home extends Local implements \OCP\Files\IHomeStorage { } - /** - * Returns the owner of this home storage - * - * @return \OC\User\User owner of this home storage - */ public function getUser(): IUser { return $this->user; } - /** - * get the owner of a path - * - * @param string $path The path to get the owner - * @return string uid or false - */ public function getOwner($path) { return $this->user->getUID(); } diff --git a/lib/private/Files/Storage/StorageFactory.php b/lib/private/Files/Storage/StorageFactory.php index 612592e2d3a..2b578951247 100644 --- a/lib/private/Files/Storage/StorageFactory.php +++ b/lib/private/Files/Storage/StorageFactory.php @@ -16,18 +16,6 @@ class StorageFactory implements IStorageFactory { */ private $storageWrappers = []; - /** - * allow modifier storage behaviour by adding wrappers around storages - * - * $callback should be a function of type (string $mountPoint, Storage $storage) => Storage - * - * @param string $wrapperName name of the wrapper - * @param callable $callback callback - * @param int $priority wrappers with the lower priority are applied last (meaning they get called first) - * @param \OCP\Files\Mount\IMountPoint[] $existingMounts existing mount points to apply the wrapper to - * @return bool true if the wrapper was added, false if there was already a wrapper with this - * name registered - */ public function addStorageWrapper($wrapperName, $callback, $priority = 50, $existingMounts = []) { if (isset($this->storageWrappers[$wrapperName])) { return false; @@ -53,14 +41,6 @@ class StorageFactory implements IStorageFactory { unset($this->storageWrappers[$wrapperName]); } - /** - * Create an instance of a storage and apply the registered storage wrappers - * - * @param \OCP\Files\Mount\IMountPoint $mountPoint - * @param string $class - * @param array $arguments - * @return \OCP\Files\Storage - */ public function getInstance(IMountPoint $mountPoint, $class, $arguments) { return $this->wrap($mountPoint, new $class($arguments)); } diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index f8aa9d963dc..d26a119b8f0 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -8,7 +8,6 @@ namespace OC\Files\Storage\Wrapper; use OC\Files\Storage\FailedStorage; -use OCP\Files\InvalidPathException; use OCP\Files\Storage\ILockingStorage; use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IWriteStreamStorage; @@ -28,9 +27,6 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea public $propagator; public $updater; - /** - * @param array $parameters - */ public function __construct($parameters) { $this->storage = $parameters['storage']; } @@ -48,270 +44,106 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->storage; } - /** - * Get the identifier for the storage, - * the returned id should be the same for every storage object that is created with the same parameters - * and two storage objects with the same id should refer to two storages that display the same files. - * - * @return string - */ public function getId() { return $this->getWrapperStorage()->getId(); } - /** - * see https://www.php.net/manual/en/function.mkdir.php - * - * @param string $path - * @return bool - */ public function mkdir($path) { return $this->getWrapperStorage()->mkdir($path); } - /** - * see https://www.php.net/manual/en/function.rmdir.php - * - * @param string $path - * @return bool - */ public function rmdir($path) { return $this->getWrapperStorage()->rmdir($path); } - /** - * see https://www.php.net/manual/en/function.opendir.php - * - * @param string $path - * @return resource|false - */ public function opendir($path) { return $this->getWrapperStorage()->opendir($path); } - /** - * see https://www.php.net/manual/en/function.is_dir.php - * - * @param string $path - * @return bool - */ public function is_dir($path) { return $this->getWrapperStorage()->is_dir($path); } - /** - * see https://www.php.net/manual/en/function.is_file.php - * - * @param string $path - * @return bool - */ public function is_file($path) { return $this->getWrapperStorage()->is_file($path); } - /** - * see https://www.php.net/manual/en/function.stat.php - * only the following keys are required in the result: size and mtime - * - * @param string $path - * @return array|bool - */ public function stat($path) { return $this->getWrapperStorage()->stat($path); } - /** - * see https://www.php.net/manual/en/function.filetype.php - * - * @param string $path - * @return string|bool - */ public function filetype($path) { return $this->getWrapperStorage()->filetype($path); } - /** - * see https://www.php.net/manual/en/function.filesize.php - * The result for filesize when called on a folder is required to be 0 - */ public function filesize($path): false|int|float { return $this->getWrapperStorage()->filesize($path); } - /** - * check if a file can be created in $path - * - * @param string $path - * @return bool - */ public function isCreatable($path) { return $this->getWrapperStorage()->isCreatable($path); } - /** - * check if a file can be read - * - * @param string $path - * @return bool - */ public function isReadable($path) { return $this->getWrapperStorage()->isReadable($path); } - /** - * check if a file can be written to - * - * @param string $path - * @return bool - */ public function isUpdatable($path) { return $this->getWrapperStorage()->isUpdatable($path); } - /** - * check if a file can be deleted - * - * @param string $path - * @return bool - */ public function isDeletable($path) { return $this->getWrapperStorage()->isDeletable($path); } - /** - * check if a file can be shared - * - * @param string $path - * @return bool - */ public function isSharable($path) { return $this->getWrapperStorage()->isSharable($path); } - /** - * get the full permissions of a path. - * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php - * - * @param string $path - * @return int - */ public function getPermissions($path) { return $this->getWrapperStorage()->getPermissions($path); } - /** - * see https://www.php.net/manual/en/function.file_exists.php - * - * @param string $path - * @return bool - */ public function file_exists($path) { return $this->getWrapperStorage()->file_exists($path); } - /** - * see https://www.php.net/manual/en/function.filemtime.php - * - * @param string $path - * @return int|bool - */ public function filemtime($path) { return $this->getWrapperStorage()->filemtime($path); } - /** - * see https://www.php.net/manual/en/function.file_get_contents.php - * - * @param string $path - * @return string|false - */ public function file_get_contents($path) { return $this->getWrapperStorage()->file_get_contents($path); } - /** - * see https://www.php.net/manual/en/function.file_put_contents.php - * - * @param string $path - * @param mixed $data - * @return int|float|false - */ public function file_put_contents($path, $data) { return $this->getWrapperStorage()->file_put_contents($path, $data); } - /** - * see https://www.php.net/manual/en/function.unlink.php - * - * @param string $path - * @return bool - */ public function unlink($path) { return $this->getWrapperStorage()->unlink($path); } - /** - * see https://www.php.net/manual/en/function.rename.php - * - * @param string $source - * @param string $target - * @return bool - */ public function rename($source, $target) { return $this->getWrapperStorage()->rename($source, $target); } - /** - * see https://www.php.net/manual/en/function.copy.php - * - * @param string $source - * @param string $target - * @return bool - */ public function copy($source, $target) { return $this->getWrapperStorage()->copy($source, $target); } - /** - * see https://www.php.net/manual/en/function.fopen.php - * - * @param string $path - * @param string $mode - * @return resource|bool - */ public function fopen($path, $mode) { return $this->getWrapperStorage()->fopen($path, $mode); } - /** - * get the mimetype for a file or folder - * The mimetype for a folder is required to be "httpd/unix-directory" - * - * @param string $path - * @return string|bool - */ public function getMimeType($path) { return $this->getWrapperStorage()->getMimeType($path); } - /** - * see https://www.php.net/manual/en/function.hash.php - * - * @param string $type - * @param string $path - * @param bool $raw - * @return string|bool - */ public function hash($type, $path, $raw = false) { return $this->getWrapperStorage()->hash($type, $path, $raw); } - /** - * see https://www.php.net/manual/en/function.free_space.php - * - * @param string $path - * @return int|float|bool - */ public function free_space($path) { return $this->getWrapperStorage()->free_space($path); } @@ -326,50 +158,18 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->search($query); } - /** - * see https://www.php.net/manual/en/function.touch.php - * If the backend does not support the operation, false should be returned - * - * @param string $path - * @param int $mtime - * @return bool - */ public function touch($path, $mtime = null) { return $this->getWrapperStorage()->touch($path, $mtime); } - /** - * get the path to a local version of the file. - * The local version of the file can be temporary and doesn't have to be persistent across requests - * - * @param string $path - * @return string|false - */ public function getLocalFile($path) { return $this->getWrapperStorage()->getLocalFile($path); } - /** - * check if a file or folder has been updated since $time - * - * @param string $path - * @param int $time - * @return bool - * - * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. - * returning true for other changes in the folder is optional - */ public function hasUpdated($path, $time) { return $this->getWrapperStorage()->hasUpdated($path, $time); } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ public function getCache($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -377,13 +177,6 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->getCache($path, $storage); } - /** - * get a scanner instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\Cache\Scanner - */ public function getScanner($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -392,23 +185,10 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea } - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ public function getOwner($path) { return $this->getWrapperStorage()->getOwner($path); } - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher - */ public function getWatcher($path = '', $storage = null) { if (!$storage) { $storage = $this; @@ -437,40 +217,18 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->getStorageCache(); } - /** - * get the ETag for a file or folder - * - * @param string $path - * @return string|false - */ public function getETag($path) { return $this->getWrapperStorage()->getETag($path); } - /** - * Returns true - * - * @return true - */ public function test() { return $this->getWrapperStorage()->test(); } - /** - * Returns the wrapped storage's value for isLocal() - * - * @return bool wrapped storage's isLocal() value - */ public function isLocal() { return $this->getWrapperStorage()->isLocal(); } - /** - * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class - * - * @param class-string<IStorage> $class - * @return bool - */ public function instanceOfStorage($class) { if (ltrim($class, '\\') === 'OC\Files\Storage\Shared') { // FIXME Temporary fix to keep existing checks working @@ -509,52 +267,22 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return call_user_func_array([$this->getWrapperStorage(), $method], $args); } - /** - * A custom storage implementation can return an url for direct download of a give file. - * - * For now the returned array can hold the parameter url - in future more attributes might follow. - * - * @param string $path - * @return array|bool - */ public function getDirectDownload($path) { return $this->getWrapperStorage()->getDirectDownload($path); } - /** - * Get availability of the storage - * - * @return array [ available, last_checked ] - */ public function getAvailability() { return $this->getWrapperStorage()->getAvailability(); } - /** - * Set availability of the storage - * - * @param bool $isAvailable - */ public function setAvailability($isAvailable) { $this->getWrapperStorage()->setAvailability($isAvailable); } - /** - * @param string $path the path of the target folder - * @param string $fileName the name of the file itself - * @return void - * @throws InvalidPathException - */ public function verifyPath($path, $fileName) { $this->getWrapperStorage()->verifyPath($path, $fileName); } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); @@ -563,12 +291,6 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); @@ -581,34 +303,18 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea return $this->getWrapperStorage()->getMetaData($path); } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function acquireLock($path, $type, ILockingProvider $provider) { if ($this->getWrapperStorage()->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { $this->getWrapperStorage()->acquireLock($path, $type, $provider); } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function releaseLock($path, $type, ILockingProvider $provider) { if ($this->getWrapperStorage()->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { $this->getWrapperStorage()->releaseLock($path, $type, $provider); } } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function changeLock($path, $type, ILockingProvider $provider) { if ($this->getWrapperStorage()->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { $this->getWrapperStorage()->changeLock($path, $type, $provider); diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index 8b20e86930a..50c5ef165d4 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -125,13 +125,6 @@ class TemplateManager implements ITemplateManager { }, $this->listCreators()); } - /** - * @param string $filePath - * @param string $templateId - * @param array $templateFields - * @return array - * @throws GenericFileException - */ public function createFromTemplate(string $filePath, string $templateId = '', string $templateType = 'user', array $templateFields = []): array { $userFolder = $this->rootFolder->getUserFolder($this->userId); try { diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index b1e4c098e54..6fce1dbfb0e 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -104,9 +104,6 @@ class Detection implements IMimeTypeDetector { $this->mimeTypeAlias = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEALIASES, $this->mimeTypeAlias); } - /** - * @return array<string,string> - */ public function getAllAliases(): array { $this->loadAliases(); return $this->mimeTypeAlias; @@ -140,12 +137,6 @@ class Detection implements IMimeTypeDetector { return $this->mimetypes; } - /** - * detect mimetype only based on filename, content of file is not used - * - * @param string $path - * @return string - */ public function detectPath($path): string { $this->loadMappings(); @@ -171,12 +162,6 @@ class Detection implements IMimeTypeDetector { return 'application/octet-stream'; } - /** - * detect mimetype only based on the content of file - * @param string $path - * @return string - * @since 18.0.0 - */ public function detectContent(string $path): string { $this->loadMappings(); @@ -236,12 +221,6 @@ class Detection implements IMimeTypeDetector { return 'application/octet-stream'; } - /** - * detect mimetype based on both filename and content - * - * @param string $path - * @return string - */ public function detect($path): string { $mimeType = $this->detectPath($path); @@ -252,12 +231,6 @@ class Detection implements IMimeTypeDetector { return $this->detectContent($path); } - /** - * detect mimetype based on the content of a string - * - * @param string $data - * @return string - */ public function detectString($data): string { if (function_exists('finfo_open') && function_exists('finfo_file')) { $finfo = finfo_open(FILEINFO_MIME); @@ -274,23 +247,12 @@ class Detection implements IMimeTypeDetector { return $mime; } - /** - * Get a secure mimetype that won't expose potential XSS. - * - * @param string $mimeType - * @return string - */ public function getSecureMimeType($mimeType): string { $this->loadMappings(); return $this->secureMimeTypes[$mimeType] ?? 'application/octet-stream'; } - /** - * Get path to the icon of a file type - * @param string $mimetype the MIME type - * @return string the url - */ public function mimeTypeIcon($mimetype): string { $this->loadAliases(); diff --git a/lib/private/Files/Type/Loader.php b/lib/private/Files/Type/Loader.php index 407df59b2e2..79c71a1bd2e 100644 --- a/lib/private/Files/Type/Loader.php +++ b/lib/private/Files/Type/Loader.php @@ -38,9 +38,6 @@ class Loader implements IMimeTypeLoader { $this->mimetypeIds = []; } - /** - * Get a mimetype from its ID - */ public function getMimetypeById(int $id): ?string { if (!$this->mimetypes) { $this->loadMimetypes(); @@ -51,9 +48,6 @@ class Loader implements IMimeTypeLoader { return null; } - /** - * Get a mimetype ID, adding the mimetype to the DB if it does not exist - */ public function getId(string $mimetype): int { if (!$this->mimetypeIds) { $this->loadMimetypes(); @@ -64,9 +58,6 @@ class Loader implements IMimeTypeLoader { return $this->store($mimetype); } - /** - * Test if a mimetype exists in the database - */ public function exists(string $mimetype): bool { if (!$this->mimetypeIds) { $this->loadMimetypes(); @@ -74,9 +65,6 @@ class Loader implements IMimeTypeLoader { return isset($this->mimetypeIds[$mimetype]); } - /** - * Clear all loaded mimetypes, allow for re-loading - */ public function reset(): void { $this->mimetypes = []; $this->mimetypeIds = []; diff --git a/lib/private/FilesMetadata/FilesMetadataManager.php b/lib/private/FilesMetadata/FilesMetadataManager.php index 231fb2ec98f..6fd4f82b7a7 100644 --- a/lib/private/FilesMetadata/FilesMetadataManager.php +++ b/lib/private/FilesMetadata/FilesMetadataManager.php @@ -22,9 +22,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Cache\CacheEntryRemovedEvent; use OCP\Files\Events\Node\NodeWrittenEvent; -use OCP\Files\InvalidPathException; use OCP\Files\Node; -use OCP\Files\NotFoundException; use OCP\FilesMetadata\Event\MetadataBackgroundEvent; use OCP\FilesMetadata\Event\MetadataLiveEvent; use OCP\FilesMetadata\Event\MetadataNamedEvent; @@ -58,20 +56,6 @@ class FilesMetadataManager implements IFilesMetadataManager { ) { } - /** - * @inheritDoc - * - * @param Node $node related node - * @param int $process type of process - * - * @return IFilesMetadata - * @throws FilesMetadataException if metadata are invalid - * @throws InvalidPathException if path to file is not valid - * @throws NotFoundException if file cannot be found - * @see self::PROCESS_BACKGROUND - * @see self::PROCESS_LIVE - * @since 28.0.0 - */ public function refreshMetadata( Node $node, int $process = self::PROCESS_LIVE, @@ -110,15 +94,6 @@ class FilesMetadataManager implements IFilesMetadataManager { return $metadata; } - /** - * @param int $fileId file id - * @param boolean $generate Generate if metadata does not exists - * - * @inheritDoc - * @return IFilesMetadata - * @throws FilesMetadataNotFoundException if not found - * @since 28.0.0 - */ public function getMetadata(int $fileId, bool $generate = false): IFilesMetadata { try { return $this->metadataRequestService->getMetadataFromFileId($fileId); @@ -131,26 +106,10 @@ class FilesMetadataManager implements IFilesMetadataManager { } } - /** - * returns metadata of multiple file ids - * - * @param int[] $fileIds file ids - * - * @return array File ID is the array key, files without metadata are not returned in the array - * @psalm-return array<int, IFilesMetadata> - * @since 28.0.0 - */ public function getMetadataForFiles(array $fileIds): array { return $this->metadataRequestService->getMetadataFromFileIds($fileIds); } - /** - * @param IFilesMetadata $filesMetadata metadata - * - * @inheritDoc - * @throws FilesMetadataException if metadata seems malformed - * @since 28.0.0 - */ public function saveMetadata(IFilesMetadata $filesMetadata): void { if ($filesMetadata->getFileId() === 0 || !$filesMetadata->updated()) { return; @@ -191,12 +150,6 @@ class FilesMetadataManager implements IFilesMetadataManager { $this->appConfig->setValueArray('core', self::CONFIG_KEY, $current->jsonSerialize(), lazy: true); } - /** - * @param int $fileId file id - * - * @inheritDoc - * @since 28.0.0 - */ public function deleteMetadata(int $fileId): void { try { $this->metadataRequestService->dropMetadata($fileId); @@ -211,16 +164,6 @@ class FilesMetadataManager implements IFilesMetadataManager { } } - /** - * @param IQueryBuilder $qb - * @param string $fileTableAlias alias of the table that contains data about files - * @param string $fileIdField alias of the field that contains file ids - * - * @inheritDoc - * @return IMetadataQuery - * @see IMetadataQuery - * @since 28.0.0 - */ public function getMetadataQuery( IQueryBuilder $qb, string $fileTableAlias, @@ -229,11 +172,6 @@ class FilesMetadataManager implements IFilesMetadataManager { return new MetadataQuery($qb, $this, $fileTableAlias, $fileIdField); } - /** - * @inheritDoc - * @return IFilesMetadata - * @since 28.0.0 - */ public function getKnownMetadata(): IFilesMetadata { if ($this->all !== null) { return $this->all; @@ -249,26 +187,6 @@ class FilesMetadataManager implements IFilesMetadataManager { return $this->all; } - /** - * @param string $key metadata key - * @param string $type metadata type - * @param bool $indexed TRUE if metadata can be search - * @param int $editPermission remote edit permission via Webdav PROPPATCH - * - * @inheritDoc - * @since 28.0.0 - * @see IMetadataValueWrapper::TYPE_INT - * @see IMetadataValueWrapper::TYPE_FLOAT - * @see IMetadataValueWrapper::TYPE_BOOL - * @see IMetadataValueWrapper::TYPE_ARRAY - * @see IMetadataValueWrapper::TYPE_STRING_LIST - * @see IMetadataValueWrapper::TYPE_INT_LIST - * @see IMetadataValueWrapper::TYPE_STRING - * @see IMetadataValueWrapper::EDIT_FORBIDDEN - * @see IMetadataValueWrapper::EDIT_REQ_OWNERSHIP - * @see IMetadataValueWrapper::EDIT_REQ_WRITE_PERMISSION - * @see IMetadataValueWrapper::EDIT_REQ_READ_PERMISSION - */ public function initMetadata( string $key, string $type, diff --git a/lib/private/FilesMetadata/Listener/MetadataUpdate.php b/lib/private/FilesMetadata/Listener/MetadataUpdate.php index 05422ba5aba..4262d3f5564 100644 --- a/lib/private/FilesMetadata/Listener/MetadataUpdate.php +++ b/lib/private/FilesMetadata/Listener/MetadataUpdate.php @@ -30,9 +30,6 @@ class MetadataUpdate implements IEventListener { ) { } - /** - * @param Event $event - */ public function handle(Event $event): void { if (!($event instanceof NodeWrittenEvent)) { return; diff --git a/lib/private/FilesMetadata/MetadataQuery.php b/lib/private/FilesMetadata/MetadataQuery.php index aac93a23446..b802743f0ee 100644 --- a/lib/private/FilesMetadata/MetadataQuery.php +++ b/lib/private/FilesMetadata/MetadataQuery.php @@ -47,11 +47,6 @@ class MetadataQuery implements IMetadataQuery { } } - /** - * @inheritDoc - * @see self::extractMetadata() - * @since 28.0.0 - */ public function retrieveMetadata(): void { $this->queryBuilder->selectAlias($this->alias . '.json', 'meta_json'); $this->queryBuilder->selectAlias($this->alias . '.sync_token', 'meta_sync_token'); @@ -61,14 +56,6 @@ class MetadataQuery implements IMetadataQuery { ); } - /** - * @param array $row result row - * - * @inheritDoc - * @return IFilesMetadata metadata - * @see self::retrieveMetadata() - * @since 28.0.0 - */ public function extractMetadata(array $row): IFilesMetadata { $fileId = (array_key_exists($this->fileIdField, $row)) ? $row[$this->fileIdField] : 0; $metadata = new FilesMetadata((int)$fileId); @@ -81,13 +68,6 @@ class MetadataQuery implements IMetadataQuery { return $metadata; } - /** - * @param string $metadataKey metadata key - * @param bool $enforce limit the request only to existing metadata - * - * @inheritDoc - * @since 28.0.0 - */ public function joinIndex(string $metadataKey, bool $enforce = false): string { if (array_key_exists($metadataKey, $this->knownJoinedIndex)) { return $this->knownJoinedIndex[$metadataKey]; @@ -130,29 +110,10 @@ class MetadataQuery implements IMetadataQuery { return $this->knownJoinedIndex[$metadataKey]; } - /** - * @inheritDoc - * - * @param string $metadataKey metadata key - * - * @return string table field - * @throws FilesMetadataNotFoundException - * @since 28.0.0 - */ public function getMetadataKeyField(string $metadataKey): string { return $this->joinedTableAlias($metadataKey) . '.meta_key'; } - /** - * @inheritDoc - * - * @param string $metadataKey metadata key - * - * @return string table field - * @throws FilesMetadataNotFoundException if metadataKey is not known - * @throws FilesMetadataTypeException is metadataKey is not set as indexed - * @since 28.0.0 - */ public function getMetadataValueField(string $metadataKey): string { if ($this->manager instanceof IFilesMetadataManager) { /** diff --git a/lib/private/FilesMetadata/Model/FilesMetadata.php b/lib/private/FilesMetadata/Model/FilesMetadata.php index dfeb429507a..69c27740d83 100644 --- a/lib/private/FilesMetadata/Model/FilesMetadata.php +++ b/lib/private/FilesMetadata/Model/FilesMetadata.php @@ -33,58 +33,26 @@ class FilesMetadata implements IFilesMetadata { ) { } - /** - * @inheritDoc - * @return int related file id - * @since 28.0.0 - */ public function getFileId(): int { return $this->fileId; } - /** - * @inheritDoc - * @return int timestamp - * @since 28.0.0 - */ public function lastUpdateTimestamp(): int { return $this->lastUpdate; } - /** - * @inheritDoc - * @return string token - * @since 28.0.0 - */ public function getSyncToken(): string { return $this->syncToken; } - /** - * @inheritDoc - * @return string[] list of keys - * @since 28.0.0 - */ public function getKeys(): array { return array_keys($this->metadata); } - /** - * @param string $needle metadata key to search - * - * @inheritDoc - * @return bool TRUE if key exist - * @since 28.0.0 - */ public function hasKey(string $needle): bool { return (in_array($needle, $this->getKeys())); } - /** - * @inheritDoc - * @return string[] list of indexes - * @since 28.0.0 - */ public function getIndexes(): array { $indexes = []; foreach ($this->getKeys() as $key) { @@ -96,25 +64,10 @@ class FilesMetadata implements IFilesMetadata { return $indexes; } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return bool TRUE if key exists and is set as indexed - * @since 28.0.0 - */ public function isIndex(string $key): bool { return $this->metadata[$key]?->isIndexed() ?? false; } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return int edit permission - * @throws FilesMetadataNotFoundException - * @since 28.0.0 - */ public function getEditPermission(string $key): int { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -123,14 +76,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getEditPermission(); } - /** - * @param string $key metadata key - * @param int $permission edit permission - * - * @inheritDoc - * @throws FilesMetadataNotFoundException - * @since 28.0.0 - */ public function setEditPermission(string $key, int $permission): void { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -156,15 +101,6 @@ class FilesMetadata implements IFilesMetadata { $this->metadata[$key]->setEtag($etag); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return string metadata value - * @throws FilesMetadataNotFoundException - * @throws FilesMetadataTypeException - * @since 28.0.0 - */ public function getString(string $key): string { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -173,15 +109,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getValueString(); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return int metadata value - * @throws FilesMetadataNotFoundException - * @throws FilesMetadataTypeException - * @since 28.0.0 - */ public function getInt(string $key): int { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -190,15 +117,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getValueInt(); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return float metadata value - * @throws FilesMetadataNotFoundException - * @throws FilesMetadataTypeException - * @since 28.0.0 - */ public function getFloat(string $key): float { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -207,15 +125,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getValueFloat(); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return bool metadata value - * @throws FilesMetadataNotFoundException - * @throws FilesMetadataTypeException - * @since 28.0.0 - */ public function getBool(string $key): bool { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -224,15 +133,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getValueBool(); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return array metadata value - * @throws FilesMetadataNotFoundException - * @throws FilesMetadataTypeException - * @since 28.0.0 - */ public function getArray(string $key): array { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -241,15 +141,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getValueArray(); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return string[] metadata value - * @throws FilesMetadataNotFoundException - * @throws FilesMetadataTypeException - * @since 28.0.0 - */ public function getStringList(string $key): array { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -258,15 +149,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getValueStringList(); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return int[] metadata value - * @throws FilesMetadataNotFoundException - * @throws FilesMetadataTypeException - * @since 28.0.0 - */ public function getIntList(string $key): array { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -275,21 +157,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getValueIntList(); } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return string value type - * @throws FilesMetadataNotFoundException - * @see IMetadataValueWrapper::TYPE_STRING - * @see IMetadataValueWrapper::TYPE_INT - * @see IMetadataValueWrapper::TYPE_FLOAT - * @see IMetadataValueWrapper::TYPE_BOOL - * @see IMetadataValueWrapper::TYPE_ARRAY - * @see IMetadataValueWrapper::TYPE_STRING_LIST - * @see IMetadataValueWrapper::TYPE_INT_LIST - * @since 28.0.0 - */ public function getType(string $key): string { if (!array_key_exists($key, $this->metadata)) { throw new FilesMetadataNotFoundException(); @@ -298,16 +165,6 @@ class FilesMetadata implements IFilesMetadata { return $this->metadata[$key]->getType(); } - /** - * @param string $key metadata key - * @param string $value metadata value - * @param bool $index set TRUE if value must be indexed - * - * @inheritDoc - * @return self - * @throws FilesMetadataKeyFormatException - * @since 28.0.0 - */ public function setString(string $key, string $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -325,16 +182,6 @@ class FilesMetadata implements IFilesMetadata { return $this; } - /** - * @param string $key metadata key - * @param int $value metadata value - * @param bool $index set TRUE if value must be indexed - * - * @inheritDoc - * @return self - * @throws FilesMetadataKeyFormatException - * @since 28.0.0 - */ public function setInt(string $key, int $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -352,15 +199,6 @@ class FilesMetadata implements IFilesMetadata { return $this; } - /** - * @param string $key metadata key - * @param float $value metadata value - * - * @inheritDoc - * @return self - * @throws FilesMetadataKeyFormatException - * @since 28.0.0 - */ public function setFloat(string $key, float $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -379,16 +217,6 @@ class FilesMetadata implements IFilesMetadata { } - /** - * @param string $key metadata key - * @param bool $value metadata value - * @param bool $index set TRUE if value must be indexed - * - * @inheritDoc - * @return self - * @throws FilesMetadataKeyFormatException - * @since 28.0.0 - */ public function setBool(string $key, bool $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -407,15 +235,6 @@ class FilesMetadata implements IFilesMetadata { } - /** - * @param string $key metadata key - * @param array $value metadata value - * - * @inheritDoc - * @return self - * @throws FilesMetadataKeyFormatException - * @since 28.0.0 - */ public function setArray(string $key, array $value): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -433,16 +252,6 @@ class FilesMetadata implements IFilesMetadata { return $this; } - /** - * @param string $key metadata key - * @param string[] $value metadata value - * @param bool $index set TRUE if each values from the list must be indexed - * - * @inheritDoc - * @return self - * @throws FilesMetadataKeyFormatException - * @since 28.0.0 - */ public function setStringList(string $key, array $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -460,16 +269,6 @@ class FilesMetadata implements IFilesMetadata { return $this; } - /** - * @param string $key metadata key - * @param int[] $value metadata value - * @param bool $index set TRUE if each values from the list must be indexed - * - * @inheritDoc - * @return self - * @throws FilesMetadataKeyFormatException - * @since 28.0.0 - */ public function setIntList(string $key, array $value, bool $index = false): IFilesMetadata { $this->confirmKeyFormat($key); try { @@ -487,13 +286,6 @@ class FilesMetadata implements IFilesMetadata { return $this; } - /** - * @param string $key metadata key - * - * @inheritDoc - * @return self - * @since 28.0.0 - */ public function unset(string $key): IFilesMetadata { if (!array_key_exists($key, $this->metadata)) { return $this; @@ -505,13 +297,6 @@ class FilesMetadata implements IFilesMetadata { return $this; } - /** - * @param string $keyPrefix metadata key prefix - * - * @inheritDoc - * @return self - * @since 28.0.0 - */ public function removeStartsWith(string $keyPrefix): IFilesMetadata { if ($keyPrefix === '') { return $this; @@ -541,11 +326,6 @@ class FilesMetadata implements IFilesMetadata { throw new FilesMetadataKeyFormatException('key can only contains alphanumerical characters, and dash (-, _)'); } - /** - * @inheritDoc - * @return bool TRUE if metadata have been modified - * @since 28.0.0 - */ public function updated(): bool { return $this->updated; } @@ -559,9 +339,6 @@ class FilesMetadata implements IFilesMetadata { return $data; } - /** - * @return array<string, string|int|bool|float|string[]|int[]> - */ public function asArray(): array { $data = []; foreach ($this->metadata as $metaKey => $metaValueWrapper) { @@ -575,13 +352,6 @@ class FilesMetadata implements IFilesMetadata { return $data; } - /** - * @param array $data - * - * @inheritDoc - * @return IFilesMetadata - * @since 28.0.0 - */ public function import(array $data): IFilesMetadata { foreach ($data as $k => $v) { $valueWrapper = new MetadataValueWrapper(); diff --git a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php index 710a8129340..7f57ec57577 100644 --- a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php +++ b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php @@ -25,72 +25,18 @@ class MetadataValueWrapper implements IMetadataValueWrapper { private bool $indexed = false; private int $editPermission = self::EDIT_FORBIDDEN; - /** - * @param string $type value type - * - * @inheritDoc - * @see self::TYPE_INT - * @see self::TYPE_FLOAT - * @see self::TYPE_BOOL - * @see self::TYPE_ARRAY - * @see self::TYPE_STRING_LIST - * @see self::TYPE_INT_LIST - * @see self::TYPE_STRING - * @since 28.0.0 - */ public function __construct(string $type = '') { $this->type = $type; } - /** - * @inheritDoc - * @return string value type - * @see self::TYPE_INT - * @see self::TYPE_FLOAT - * @see self::TYPE_BOOL - * @see self::TYPE_ARRAY - * @see self::TYPE_STRING_LIST - * @see self::TYPE_INT_LIST - * @see self::TYPE_STRING - * @since 28.0.0 - */ public function getType(): string { return $this->type; } - /** - * @param string $type value type - * - * @inheritDoc - * @return bool - * @see self::TYPE_INT - * @see self::TYPE_FLOAT - * @see self::TYPE_BOOL - * @see self::TYPE_ARRAY - * @see self::TYPE_STRING_LIST - * @see self::TYPE_INT_LIST - * @see self::TYPE_STRING - * @since 28.0.0 - */ public function isType(string $type): bool { return (strtolower($type) === strtolower($this->type)); } - /** - * @param string $type value type - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if type cannot be confirmed - * @see self::TYPE_INT - * @see self::TYPE_BOOL - * @see self::TYPE_ARRAY - * @see self::TYPE_STRING_LIST - * @see self::TYPE_INT_LIST - * @see self::TYPE_STRING - * @see self::TYPE_FLOAT - * @since 28.0.0 - */ public function assertType(string $type): self { if (!$this->isType($type)) { throw new FilesMetadataTypeException('type is \'' . $this->getType() . '\', expecting \'' . $type . '\''); @@ -99,14 +45,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } - /** - * @param string $value string to be set as value - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if wrapper was not set to store a string - * @since 28.0.0 - */ public function setValueString(string $value): self { $this->assertType(self::TYPE_STRING); $this->value = $value; @@ -114,14 +52,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } - /** - * @param int $value int to be set as value - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if wrapper was not set to store an int - * @since 28.0.0 - */ public function setValueInt(int $value): self { $this->assertType(self::TYPE_INT); $this->value = $value; @@ -129,14 +59,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } - /** - * @param float $value float to be set as value - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if wrapper was not set to store a float - * @since 28.0.0 - */ public function setValueFloat(float $value): self { $this->assertType(self::TYPE_FLOAT); $this->value = $value; @@ -144,14 +66,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } - /** - * @param bool $value bool to be set as value - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if wrapper was not set to store a bool - * @since 28.0.0 - */ public function setValueBool(bool $value): self { $this->assertType(self::TYPE_BOOL); $this->value = $value; @@ -160,14 +74,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } - /** - * @param array $value array to be set as value - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if wrapper was not set to store an array - * @since 28.0.0 - */ public function setValueArray(array $value): self { $this->assertType(self::TYPE_ARRAY); $this->value = $value; @@ -175,14 +81,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } - /** - * @param string[] $value string list to be set as value - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if wrapper was not set to store a string list - * @since 28.0.0 - */ public function setValueStringList(array $value): self { $this->assertType(self::TYPE_STRING_LIST); // TODO confirm value is an array or string ? @@ -191,14 +89,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this; } - /** - * @param int[] $value int list to be set as value - * - * @inheritDoc - * @return self - * @throws FilesMetadataTypeException if wrapper was not set to store an int list - * @since 28.0.0 - */ public function setValueIntList(array $value): self { $this->assertType(self::TYPE_INT_LIST); // TODO confirm value is an array of int ? @@ -208,13 +98,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { } - /** - * @inheritDoc - * @return string set value - * @throws FilesMetadataTypeException if wrapper was not set to store a string - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueString(): string { $this->assertType(self::TYPE_STRING); if ($this->value === null) { @@ -224,13 +107,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return (string)$this->value; } - /** - * @inheritDoc - * @return int set value - * @throws FilesMetadataTypeException if wrapper was not set to store an int - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueInt(): int { $this->assertType(self::TYPE_INT); if ($this->value === null) { @@ -240,13 +116,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return (int)$this->value; } - /** - * @inheritDoc - * @return float set value - * @throws FilesMetadataTypeException if wrapper was not set to store a float - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueFloat(): float { $this->assertType(self::TYPE_FLOAT); if ($this->value === null) { @@ -256,13 +125,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return (float)$this->value; } - /** - * @inheritDoc - * @return bool set value - * @throws FilesMetadataTypeException if wrapper was not set to store a bool - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueBool(): bool { $this->assertType(self::TYPE_BOOL); if ($this->value === null) { @@ -272,13 +134,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return (bool)$this->value; } - /** - * @inheritDoc - * @return array set value - * @throws FilesMetadataTypeException if wrapper was not set to store an array - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueArray(): array { $this->assertType(self::TYPE_ARRAY); if ($this->value === null) { @@ -288,13 +143,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return (array)$this->value; } - /** - * @inheritDoc - * @return string[] set value - * @throws FilesMetadataTypeException if wrapper was not set to store a string list - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueStringList(): array { $this->assertType(self::TYPE_STRING_LIST); if ($this->value === null) { @@ -304,13 +152,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return (array)$this->value; } - /** - * @inheritDoc - * @return int[] set value - * @throws FilesMetadataTypeException if wrapper was not set to store an int list - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueIntList(): array { $this->assertType(self::TYPE_INT_LIST); if ($this->value === null) { @@ -320,12 +161,6 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return (array)$this->value; } - /** - * @inheritDoc - * @return string|int|float|bool|array|string[]|int[] set value - * @throws FilesMetadataNotFoundException if value is not set - * @since 28.0.0 - */ public function getValueAny(): mixed { if ($this->value === null) { throw new FilesMetadataNotFoundException('value is not set'); @@ -334,79 +169,35 @@ class MetadataValueWrapper implements IMetadataValueWrapper { return $this->value; } - /** - * @inheritDoc - * @return string stored etag - * @since 29.0.0 - */ public function getEtag(): string { return $this->etag; } - /** - * @param string $etag etag value - * - * @inheritDoc - * @return self - * @since 29.0.0 - */ public function setEtag(string $etag): self { $this->etag = $etag; return $this; } - /** - * @param bool $indexed TRUE to set the stored value as an indexed value - * - * @inheritDoc - * @return self - * @since 28.0.0 - */ public function setIndexed(bool $indexed): self { $this->indexed = $indexed; return $this; } - /** - * @inheritDoc - * @return bool TRUE if value is an indexed value - * @since 28.0.0 - */ public function isIndexed(): bool { return $this->indexed; } - /** - * @param int $permission edit permission - * - * @inheritDoc - * @return self - * @since 28.0.0 - */ public function setEditPermission(int $permission): self { $this->editPermission = $permission; return $this; } - /** - * @inheritDoc - * @return int edit permission - * @since 28.0.0 - */ public function getEditPermission(): int { return $this->editPermission; } - /** - * @param array $data serialized version of the object - * - * @inheritDoc - * @return self - * @see jsonSerialize - * @since 28.0.0 - */ public function import(array $data): self { $this->value = $data['value'] ?? null; $this->type = $data['type'] ?? ''; diff --git a/lib/private/FullTextSearch/FullTextSearchManager.php b/lib/private/FullTextSearch/FullTextSearchManager.php index 3ef8547ad3f..24362af0009 100644 --- a/lib/private/FullTextSearch/FullTextSearchManager.php +++ b/lib/private/FullTextSearch/FullTextSearchManager.php @@ -11,7 +11,6 @@ namespace OC\FullTextSearch; use OCP\FullTextSearch\Exceptions\FullTextSearchAppNotAvailableException; use OCP\FullTextSearch\IFullTextSearchManager; use OCP\FullTextSearch\Model\IIndex; -use OCP\FullTextSearch\Model\ISearchResult; use OCP\FullTextSearch\Service\IIndexService; use OCP\FullTextSearch\Service\IProviderService; use OCP\FullTextSearch\Service\ISearchService; @@ -28,30 +27,18 @@ class FullTextSearchManager implements IFullTextSearchManager { private ?ISearchService $searchService = null; - /** - * @since 15.0.0 - */ public function registerProviderService(IProviderService $providerService): void { $this->providerService = $providerService; } - /** - * @since 15.0.0 - */ public function registerIndexService(IIndexService $indexService): void { $this->indexService = $indexService; } - /** - * @since 15.0.0 - */ public function registerSearchService(ISearchService $searchService): void { $this->searchService = $searchService; } - /** - * @since 16.0.0 - */ public function isAvailable(): bool { if ($this->indexService === null || $this->providerService === null || @@ -99,34 +86,20 @@ class FullTextSearchManager implements IFullTextSearchManager { } - /** - * @throws FullTextSearchAppNotAvailableException - */ public function addJavascriptAPI(): void { $this->getProviderService()->addJavascriptAPI(); } - /** - * @throws FullTextSearchAppNotAvailableException - */ public function isProviderIndexed(string $providerId): bool { return $this->getProviderService()->isProviderIndexed($providerId); } - /** - * @throws FullTextSearchAppNotAvailableException - */ public function getIndex(string $providerId, string $documentId): IIndex { return $this->getIndexService()->getIndex($providerId, $documentId); } - /** - * @see IIndex for available value for $status. - * - * @throws FullTextSearchAppNotAvailableException - */ public function createIndex( string $providerId, string $documentId, @@ -137,11 +110,6 @@ class FullTextSearchManager implements IFullTextSearchManager { } - /** - * @see IIndex for available value for $status. - * - * @throws FullTextSearchAppNotAvailableException - */ public function updateIndexStatus( string $providerId, string $documentId, @@ -151,11 +119,6 @@ class FullTextSearchManager implements IFullTextSearchManager { $this->getIndexService()->updateIndexStatus($providerId, $documentId, $status, $reset); } - /** - * @see IIndex for available value for $status. - * - * @throws FullTextSearchAppNotAvailableException - */ public function updateIndexesStatus( string $providerId, array $documentIds, @@ -166,20 +129,11 @@ class FullTextSearchManager implements IFullTextSearchManager { } - /** - * @param IIndex[] $indexes - * - * @throws FullTextSearchAppNotAvailableException - */ public function updateIndexes(array $indexes): void { $this->getIndexService()->updateIndexes($indexes); } - /** - * @return ISearchResult[] - * @throws FullTextSearchAppNotAvailableException - */ public function search(array $request, string $userId = ''): array { $searchRequest = $this->getSearchService()->generateSearchRequest($request); diff --git a/lib/private/FullTextSearch/Model/DocumentAccess.php b/lib/private/FullTextSearch/Model/DocumentAccess.php index 9efffeaee88..48a99ce04a4 100644 --- a/lib/private/FullTextSearch/Model/DocumentAccess.php +++ b/lib/private/FullTextSearch/Model/DocumentAccess.php @@ -44,208 +44,108 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable { private array $links = []; - /** - * Owner of the document can be set at the init of the object. - * - * @since 16.0.0 - * - * IDocumentAccess constructor. - */ public function __construct(string $ownerId = '') { $this->setOwnerId($ownerId); } - /** - * Set the Owner of the document. - * - * @since 16.0.0 - */ public function setOwnerId(string $ownerId): IDocumentAccess { $this->ownerId = $ownerId; return $this; } - /** - * Get the Owner of the document. - * - * @since 16.0.0 - */ public function getOwnerId(): string { return $this->ownerId; } - /** - * Set the viewer of the document. - * - * @since 16.0.0 - */ public function setViewerId(string $viewerId): IDocumentAccess { $this->viewerId = $viewerId; return $this; } - /** - * Get the viewer of the document. - * - * @since 16.0.0 - */ public function getViewerId(): string { return $this->viewerId; } - /** - * Set the list of users that have read access to the document. - * - * @since 16.0.0 - */ public function setUsers(array $users): IDocumentAccess { $this->users = $users; return $this; } - /** - * Add an entry to the list of users that have read access to the document. - * - * @since 16.0.0 - */ public function addUser(string $user): IDocumentAccess { $this->users[] = $user; return $this; } - /** - * Add multiple entries to the list of users that have read access to the - * document. - * - * @since 16.0.0 - */ public function addUsers($users): IDocumentAccess { $this->users = array_merge($this->users, $users); return $this; } - /** - * Get the complete list of users that have read access to the document. - * - * @since 16.0.0 - */ public function getUsers(): array { return $this->users; } - /** - * Set the list of groups that have read access to the document. - * - * @since 16.0.0 - */ public function setGroups(array $groups): IDocumentAccess { $this->groups = $groups; return $this; } - /** - * Add an entry to the list of groups that have read access to the document. - * - * @since 16.0.0 - */ public function addGroup(string $group): IDocumentAccess { $this->groups[] = $group; return $this; } - /** - * Add multiple entries to the list of groups that have read access to the - * document. - * - * @since 16.0.0 - */ public function addGroups(array $groups): IDocumentAccess { $this->groups = array_merge($this->groups, $groups); return $this; } - /** - * Get the complete list of groups that have read access to the document. - * - * @since 16.0.0 - */ public function getGroups(): array { return $this->groups; } - /** - * Set the list of circles that have read access to the document. - * - * @since 16.0.0 - */ public function setCircles(array $circles): IDocumentAccess { $this->circles = $circles; return $this; } - /** - * Add an entry to the list of circles that have read access to the document. - * - * @since 16.0.0 - */ public function addCircle(string $circle): IDocumentAccess { $this->circles[] = $circle; return $this; } - /** - * Add multiple entries to the list of groups that have read access to the - * document. - * - * @since 16.0.0 - */ public function addCircles(array $circles): IDocumentAccess { $this->circles = array_merge($this->circles, $circles); return $this; } - /** - * Get the complete list of circles that have read access to the document. - * - * @since 16.0.0 - */ public function getCircles(): array { return $this->circles; } - /** - * Set the list of links that have read access to the document. - * - * @since 16.0.0 - */ public function setLinks(array $links): IDocumentAccess { $this->links = $links; return $this; } - /** - * Get the list of links that have read access to the document. - * - * @since 16.0.0 - */ public function getLinks(): array { return $this->links; } diff --git a/lib/private/FullTextSearch/Model/IndexDocument.php b/lib/private/FullTextSearch/Model/IndexDocument.php index 8bd20bad1e0..a52f1e415ee 100644 --- a/lib/private/FullTextSearch/Model/IndexDocument.php +++ b/lib/private/FullTextSearch/Model/IndexDocument.php @@ -83,45 +83,22 @@ class IndexDocument implements IIndexDocument, JsonSerializable { } - /** - * Returns the Id of the original document. - * - * @since 15.0.0 - */ final public function getId(): string { return $this->id; } - /** - * Returns the Id of the provider. - * - * @since 15.0.0 - */ final public function getProviderId(): string { return $this->providerId; } - /** - * Set the Index related to the IIndexDocument. - * - * @see IIndex - * - * @since 15.0.0 - */ final public function setIndex(IIndex $index): IIndexDocument { $this->index = $index; return $this; } - /** - * Get the Index. - * - * @throws FullTextSearchIndexNotAvailableException - * @since 15.0.0 - */ final public function getIndex(): IIndex { if ($this->index === null) { throw new FullTextSearchIndexNotAvailableException('No IIndex generated'); @@ -130,137 +107,70 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this->index; } - /** - * return if Index is defined. - * - * @since 16.0.0 - */ final public function hasIndex(): bool { return $this->index !== null; } - /** - * Set the modified time of the original document. - * - * @since 15.0.0 - */ final public function setModifiedTime(int $modifiedTime): IIndexDocument { $this->modifiedTime = $modifiedTime; return $this; } - /** - * Get the modified time of the original document. - * - * @since 15.0.0 - */ final public function getModifiedTime(): int { return $this->modifiedTime; } - /** - * Check if the original document of the IIndexDocument is older than $time. - * - * @since 15.0.0 - */ final public function isOlderThan(int $time): bool { return ($this->modifiedTime < $time); } - /** - * Set the read rights of the original document using a IDocumentAccess. - * - * @see IDocumentAccess - * - * @since 15.0.0 - */ final public function setAccess(IDocumentAccess $access): IIndexDocument { $this->access = $access; return $this; } - /** - * Get the IDocumentAccess related to the original document. - * - * @since 15.0.0 - */ final public function getAccess(): IDocumentAccess { return $this->access; } - /** - * Add a tag to the list. - * - * @since 15.0.0 - */ final public function addTag(string $tag): IIndexDocument { $this->tags[] = $tag; return $this; } - /** - * Set the list of tags assigned to the original document. - * - * @since 15.0.0 - */ final public function setTags(array $tags): IIndexDocument { $this->tags = $tags; return $this; } - /** - * Get the list of tags assigned to the original document. - * - * @since 15.0.0 - */ final public function getTags(): array { return $this->tags; } - /** - * Add a meta tag to the list. - * - * @since 15.0.0 - */ final public function addMetaTag(string $tag): IIndexDocument { $this->metaTags[] = $tag; return $this; } - /** - * Set the list of meta tags assigned to the original document. - * - * @since 15.0.0 - */ final public function setMetaTags(array $tags): IIndexDocument { $this->metaTags = $tags; return $this; } - /** - * Get the list of meta tags assigned to the original document. - * - * @since 15.0.0 - */ final public function getMetaTags(): array { return $this->metaTags; } - /** - * Add a sub tag to the list. - * - * @since 15.0.0 - */ final public function addSubTag(string $sub, string $tag): IIndexDocument { if (!array_key_exists($sub, $this->subTags)) { $this->subTags[$sub] = []; @@ -272,24 +182,12 @@ class IndexDocument implements IIndexDocument, JsonSerializable { } - /** - * Set the list of sub tags assigned to the original document. - * - * @since 15.0.0 - */ final public function setSubTags(array $tags): IIndexDocument { $this->subTags = $tags; return $this; } - /** - * Get the list of sub tags assigned to the original document. - * If $formatted is true, the result will be formatted in a one - * dimensional array. - * - * @since 15.0.0 - */ final public function getSubTags(bool $formatted = false): array { if ($formatted === false) { return $this->subTags; @@ -308,55 +206,28 @@ class IndexDocument implements IIndexDocument, JsonSerializable { } - /** - * Set the source of the original document. - * - * @since 15.0.0 - */ final public function setSource(string $source): IIndexDocument { $this->source = $source; return $this; } - /** - * Get the source of the original document. - * - * @since 15.0.0 - */ final public function getSource(): string { return $this->source; } - /** - * Set the title of the original document. - * - * @since 15.0.0 - */ final public function setTitle(string $title): IIndexDocument { $this->title = $title; return $this; } - /** - * Get the title of the original document. - * - * @since 15.0.0 - */ final public function getTitle(): string { return $this->title; } - /** - * Set the content of the document. - * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or - * encoded in base64. - * - * @since 15.0.0 - */ final public function setContent(string $content, int $encoded = 0): IIndexDocument { $this->content = $content; $this->contentEncoded = $encoded; @@ -364,39 +235,19 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this; } - /** - * Get the content of the original document. - * - * @since 15.0.0 - */ final public function getContent(): string { return $this->content; } - /** - * Returns the type of the encoding on the content. - * - * @since 15.0.0 - */ final public function isContentEncoded(): int { return $this->contentEncoded; } - /** - * Return the size of the content. - * - * @since 15.0.0 - */ final public function getContentSize(): int { return strlen($this->getContent()); } - /** - * Generate a hash, based on the content of the original document. - * - * @since 15.0.0 - */ final public function initHash(): IIndexDocument { if ($this->getContent() === '' || is_null($this->getContent())) { return $this; @@ -407,110 +258,56 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this; } - /** - * Set the hash of the original document. - * - * @since 15.0.0 - */ final public function setHash(string $hash): IIndexDocument { $this->hash = $hash; return $this; } - /** - * Get the hash of the original document. - * - * @since 15.0.0 - */ final public function getHash(): string { return $this->hash; } - /** - * Add a part, identified by a string, and its content. - * - * It is strongly advised to use alphanumerical chars with no space in the - * $part string. - * - * @since 15.0.0 - */ final public function addPart(string $part, string $content): IIndexDocument { $this->parts[$part] = $content; return $this; } - /** - * Set all parts and their content. - * - * @since 15.0.0 - */ final public function setParts(array $parts): IIndexDocument { $this->parts = $parts; return $this; } - /** - * Get all parts of the IIndexDocument. - * - * @since 15.0.0 - */ final public function getParts(): array { return $this->parts; } - /** - * Add a link, usable by the frontend. - * - * @since 15.0.0 - */ final public function setLink(string $link): IIndexDocument { $this->link = $link; return $this; } - /** - * Get the link. - * - * @since 15.0.0 - */ final public function getLink(): string { return $this->link; } - /** - * Set more information that couldn't be set using other method. - * - * @since 15.0.0 - */ final public function setMore(array $more): IIndexDocument { $this->more = $more; return $this; } - /** - * Get more information. - * - * @since 15.0.0 - */ final public function getMore(): array { return $this->more; } - /** - * Add some excerpt of the content of the original document, usually based - * on the search request. - * - * @since 16.0.0 - */ final public function addExcerpt(string $source, string $excerpt): IIndexDocument { $this->excerpts[] = [ @@ -522,11 +319,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable { } - /** - * Set all excerpts of the content of the original document. - * - * @since 16.0.0 - */ final public function setExcerpts(array $excerpts): IIndexDocument { $new = []; foreach ($excerpts as $entry) { @@ -541,11 +333,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this; } - /** - * Get all excerpts of the content of the original document. - * - * @since 15.0.0 - */ final public function getExcerpts(): array { return $this->excerpts; } @@ -567,48 +354,23 @@ class IndexDocument implements IIndexDocument, JsonSerializable { } - /** - * Set the score to the result assigned to this document during a search - * request. - * - * @since 15.0.0 - */ final public function setScore(string $score): IIndexDocument { $this->score = $score; return $this; } - /** - * Get the score. - * - * @since 15.0.0 - */ final public function getScore(): string { return $this->score; } - /** - * Set some information about the original document that will be available - * to the front-end when displaying search result. (as string) - * Because this information will not be indexed, this method can also be - * used to manage some data while filling the IIndexDocument before its - * indexing. - * - * @since 15.0.0 - */ final public function setInfo(string $info, string $value): IIndexDocument { $this->info[$info] = $value; return $this; } - /** - * Get an information about a document. (string) - * - * @since 15.0.0 - */ final public function getInfo(string $info, string $default = ''): string { if (!key_exists($info, $this->info)) { return $default; @@ -617,26 +379,12 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this->info[$info]; } - /** - * Set some information about the original document that will be available - * to the front-end when displaying search result. (as array) - * Because this information will not be indexed, this method can also be - * used to manage some data while filling the IIndexDocument before its - * indexing. - * - * @since 15.0.0 - */ final public function setInfoArray(string $info, array $value): IIndexDocument { $this->info[$info] = $value; return $this; } - /** - * Get an information about a document. (array) - * - * @since 15.0.0 - */ final public function getInfoArray(string $info, array $default = []): array { if (!key_exists($info, $this->info)) { return $default; @@ -645,26 +393,12 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this->info[$info]; } - /** - * Set some information about the original document that will be available - * to the front-end when displaying search result. (as int) - * Because this information will not be indexed, this method can also be - * used to manage some data while filling the IIndexDocument before its - * indexing. - * - * @since 15.0.0 - */ final public function setInfoInt(string $info, int $value): IIndexDocument { $this->info[$info] = $value; return $this; } - /** - * Get an information about a document. (int) - * - * @since 15.0.0 - */ final public function getInfoInt(string $info, int $default = 0): int { if (!key_exists($info, $this->info)) { return $default; @@ -673,26 +407,12 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this->info[$info]; } - /** - * Set some information about the original document that will be available - * to the front-end when displaying search result. (as bool) - * Because this information will not be indexed, this method can also be - * used to manage some data while filling the IIndexDocument before its - * indexing. - * - * @since 15.0.0 - */ final public function setInfoBool(string $info, bool $value): IIndexDocument { $this->info[$info] = $value; return $this; } - /** - * Get an information about a document. (bool) - * - * @since 15.0.0 - */ final public function getInfoBool(string $info, bool $default = false): bool { if (!key_exists($info, $this->info)) { return $default; @@ -701,11 +421,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this->info[$info]; } - /** - * Get all info. - * - * @since 15.0.0 - */ final public function getInfoAll(): array { $info = []; foreach ($this->info as $k => $v) { diff --git a/lib/private/FullTextSearch/Model/SearchOption.php b/lib/private/FullTextSearch/Model/SearchOption.php index c7769a62138..3a20a0f26b1 100644 --- a/lib/private/FullTextSearch/Model/SearchOption.php +++ b/lib/private/FullTextSearch/Model/SearchOption.php @@ -84,112 +84,55 @@ final class SearchOption implements ISearchOption, JsonSerializable { } - /** - * Set the name/key of the option. - * The string should only contain alphanumerical chars and underscore. - * The key can be retrieved when using ISearchRequest::getOption - * - * @see ISearchRequest::getOption - * - * @since 15.0.0 - */ public function setName(string $name): ISearchOption { $this->name = $name; return $this; } - /** - * Get the name/key of the option. - * - * @since 15.0.0 - */ public function getName(): string { return $this->name; } - /** - * Set the title/display name of the option. - * - * @since 15.0.0 - */ public function setTitle(string $title): ISearchOption { $this->title = $title; return $this; } - /** - * Get the title of the option. - * - * @since 15.0.0 - */ public function getTitle(): string { return $this->title; } - /** - * Set the type of the option. - * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT - * - * @since 15.0.0 - */ public function setType(string $type): ISearchOption { $this->type = $type; return $this; } - /** - * Get the type of the option. - * - * @since 15.0.0 - */ public function getType(): string { return $this->type; } - /** - * In case of Type is INPUT, set the size of the input field. - * Value can be ISearchOption::INPUT_SMALL or not defined. - * - * @since 15.0.0 - */ public function setSize(string $size): ISearchOption { $this->size = $size; return $this; } - /** - * Get the size of the INPUT. - * - * @since 15.0.0 - */ public function getSize(): string { return $this->size; } - /** - * In case of Type is , set the placeholder to be displayed in the input - * field. - * - * @since 15.0.0 - */ public function setPlaceholder(string $placeholder): ISearchOption { $this->placeholder = $placeholder; return $this; } - /** - * Get the placeholder. - * - * @since 15.0.0 - */ public function getPlaceholder(): string { return $this->placeholder; } diff --git a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php index 5b075daf7e6..17b148f29e0 100644 --- a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php +++ b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php @@ -33,30 +33,15 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS } - /** - * Get the compare type of the query - * - * @since 17.0.0 - */ public function getType(): int { return $this->type; } - /** - * Get the field to apply query - * - * @since 17.0.0 - */ public function getField(): string { return $this->field; } - /** - * Set the field to apply query - * - * @since 17.0.0 - */ public function setField(string $field): ISearchRequestSimpleQuery { $this->field = $field; @@ -64,54 +49,29 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS } - /** - * Get the value to compare (string) - * - * @since 17.0.0 - */ public function getValues(): array { return $this->values; } - /** - * Add value to compare (string) - * - * @since 17.0.0 - */ public function addValue(string $value): ISearchRequestSimpleQuery { $this->values[] = $value; return $this; } - /** - * Add value to compare (int) - * - * @since 17.0.0 - */ public function addValueInt(int $value): ISearchRequestSimpleQuery { $this->values[] = $value; return $this; } - /** - * Add value to compare (array) - * - * @since 17.0.0 - */ public function addValueArray(array $value): ISearchRequestSimpleQuery { $this->values[] = $value; return $this; } - /** - * Add value to compare (bool) - * - * @since 17.0.0 - */ public function addValueBool(bool $value): ISearchRequestSimpleQuery { $this->values[] = $value; diff --git a/lib/private/FullTextSearch/Model/SearchTemplate.php b/lib/private/FullTextSearch/Model/SearchTemplate.php index c2929bea139..2277f184a1e 100644 --- a/lib/private/FullTextSearch/Model/SearchTemplate.php +++ b/lib/private/FullTextSearch/Model/SearchTemplate.php @@ -62,115 +62,56 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable { } - /** - * Set the class of the icon to be displayed in the left panel of the - * FullTextSearch navigation page, in front of the related Content Provider. - * - * @since 15.0.0 - */ public function setIcon(string $class): ISearchTemplate { $this->icon = $class; return $this; } - /** - * Get the class of the icon. - */ public function getIcon(): string { return $this->icon; } - /** - * Set the path of a CSS file that will be loaded when needed. - * - * @since 15.0.0 - */ public function setCss(string $css): ISearchTemplate { $this->css = $css; return $this; } - /** - * Get the path of the CSS file. - * - * @since 15.0.0 - */ public function getCss(): string { return $this->css; } - /** - * Set the path of the file of a template that the HTML will be displayed - * below the Options. - * This should only be used if your Content Provider needs to set options in - * a way not generated by FullTextSearch - * - * @since 15.0.0 - */ public function setTemplate(string $template): ISearchTemplate { $this->template = $template; return $this; } - /** - * Get the path of the template file. - * - * @since 15.0.0 - */ public function getTemplate(): string { return $this->template; } - /** - * Add an option in the Panel that is displayed when the user start a search - * within the app that generate the content. - * - * @see ISearchOption - * - * @since 15.0.0 - */ public function addPanelOption(ISearchOption $option): ISearchTemplate { $this->panelOptions[] = $option; return $this; } - /** - * Get all options to be displayed in the Panel. - * - * @since 15.0.0 - * - * @return SearchOption[] - */ public function getPanelOptions(): array { return $this->panelOptions; } - /** - * Add an option in the left panel of the FullTextSearch navigation page. - * - * @see ISearchOption - * - * @since 15.0.0 - */ public function addNavigationOption(ISearchOption $option): ISearchTemplate { $this->navigationOptions[] = $option; return $this; } - /** - * Get all options to be displayed in the FullTextSearch navigation page. - * - * @since 15.0.0 - */ public function getNavigationOptions(): array { return $this->navigationOptions; } diff --git a/lib/private/GlobalScale/Config.php b/lib/private/GlobalScale/Config.php index 02acc1ab50a..c6231a29fba 100644 --- a/lib/private/GlobalScale/Config.php +++ b/lib/private/GlobalScale/Config.php @@ -20,22 +20,10 @@ class Config implements \OCP\GlobalScale\IConfig { $this->config = $config; } - /** - * check if global scale is enabled - * - * @since 12.0.1 - * @return bool - */ public function isGlobalScaleEnabled() { return $this->config->getSystemValueBool('gs.enabled', false); } - /** - * check if federation should only be used internally in a global scale setup - * - * @since 12.0.1 - * @return bool - */ public function onlyInternalFederation() { // if global scale is disabled federation works always globally $gsEnabled = $this->isGlobalScaleEnabled(); diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php index f6844308a15..7241510b9fe 100644 --- a/lib/private/Group/Backend.php +++ b/lib/private/Group/Backend.php @@ -44,73 +44,26 @@ abstract class Backend implements \OCP\GroupInterface { return $actions; } - /** - * Check if backend implements actions - * @param int $actions bitwise-or'ed actions - * @return bool - * - * Returns the supported actions as int to be - * compared with \OC\Group\Backend::CREATE_GROUP etc. - */ public function implementsActions($actions) { return (bool)($this->getSupportedActions() & $actions); } - /** - * is user in group? - * @param string $uid uid of the user - * @param string $gid gid of the group - * @return bool - * - * Checks whether the user is member of a group or not. - */ public function inGroup($uid, $gid) { return in_array($gid, $this->getUserGroups($uid)); } - /** - * Get all groups a user belongs to - * @param string $uid Name of the user - * @return array an array of group names - * - * This function fetches all groups a user belongs to. It does not check - * if the user exists at all. - */ public function getUserGroups($uid) { return []; } - /** - * get a list of all groups - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of group names - * - * Returns a list with all groups - */ - public function getGroups($search = '', $limit = -1, $offset = 0) { return []; } - /** - * check if a group exists - * @param string $gid - * @return bool - */ public function groupExists($gid) { return in_array($gid, $this->getGroups($gid, 1)); } - /** - * get a list of all users in a group - * @param string $gid - * @param string $search - * @param int $limit - * @param int $offset - * @return array<int,string> an array of user ids - */ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { return []; } diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 72cd0ea4a91..58e76a006e8 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -88,13 +88,6 @@ class Database extends ABackend implements return $gid; } - /** - * delete a group - * @param string $gid gid of the group to delete - * @return bool - * - * Deletes a group and removes it from the group_user-table - */ public function deleteGroup(string $gid): bool { $this->fixDI(); @@ -147,14 +140,6 @@ class Database extends ABackend implements return $result ? true : false; } - /** - * Add a user to a group - * @param string $uid Name of the user to add to group - * @param string $gid Name of the group in which add the user - * @return bool - * - * Adds a user to a group. - */ public function addToGroup(string $uid, string $gid): bool { $this->fixDI(); @@ -171,14 +156,6 @@ class Database extends ABackend implements } } - /** - * Removes a user from a group - * @param string $uid Name of the user to remove from group - * @param string $gid Name of the group from which remove the user - * @return bool - * - * removes the user from a group. - */ public function removeFromGroup(string $uid, string $gid): bool { $this->fixDI(); @@ -306,9 +283,6 @@ class Database extends ABackend implements return false; } - /** - * {@inheritdoc} - */ public function groupsExists(array $gids): array { $notFoundGids = []; $existingGroups = []; @@ -403,12 +377,6 @@ class Database extends ABackend implements return $users; } - /** - * get the number of all users matching the search string in a group - * @param string $gid - * @param string $search - * @return int - */ public function countUsersInGroup(string $gid, string $search = ''): int { $this->fixDI(); @@ -436,13 +404,6 @@ class Database extends ABackend implements return $count; } - /** - * get the number of disabled users in a group - * - * @param string $search - * - * @return int - */ public function countDisabledInGroup(string $gid): int { $this->fixDI(); @@ -500,9 +461,6 @@ class Database extends ABackend implements return []; } - /** - * {@inheritdoc} - */ public function getGroupsDetails(array $gids): array { $notFoundGids = []; $details = []; @@ -560,11 +518,6 @@ class Database extends ABackend implements return true; } - /** - * Backend name to be shown in group management - * @return string the name of the backend to be shown - * @since 21.0.0 - */ public function getBackendName(): string { return 'Database'; } diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 147c5baf543..e8a7eed144a 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -96,11 +96,6 @@ class Group implements IGroup { return false; } - /** - * get all users in the group - * - * @return \OC\User\User[] - */ public function getUsers(): array { if ($this->usersLoaded) { return $this->users; @@ -122,12 +117,6 @@ class Group implements IGroup { return $this->users; } - /** - * check if a user is in the group - * - * @param IUser $user - * @return bool - */ public function inGroup(IUser $user): bool { if (isset($this->users[$user->getUID()])) { return true; @@ -141,11 +130,6 @@ class Group implements IGroup { return false; } - /** - * add a user to the group - * - * @param IUser $user - */ public function addUser(IUser $user): void { if ($this->inGroup($user)) { return; @@ -171,9 +155,6 @@ class Group implements IGroup { } } - /** - * remove a user from the group - */ public function removeUser(IUser $user): void { $result = false; $this->dispatcher->dispatchTyped(new BeforeUserRemovedEvent($this, $user)); @@ -202,10 +183,6 @@ class Group implements IGroup { } } - /** - * Search for users in the group by userid or display name - * @return IUser[] - */ public function searchUsers(string $search, ?int $limit = null, ?int $offset = null): array { $users = []; foreach ($this->backends as $backend) { @@ -227,12 +204,6 @@ class Group implements IGroup { return $users; } - /** - * returns the number of users matching the search string - * - * @param string $search - * @return int|bool - */ public function count($search = ''): int|bool { $users = false; foreach ($this->backends as $backend) { @@ -248,11 +219,6 @@ class Group implements IGroup { return $users; } - /** - * returns the number of disabled users - * - * @return int|bool - */ public function countDisabled(): int|bool { $users = false; foreach ($this->backends as $backend) { @@ -268,24 +234,10 @@ class Group implements IGroup { return $users; } - /** - * search for users in the group by displayname - * - * @param string $search - * @param int $limit - * @param int $offset - * @return IUser[] - * @deprecated 27.0.0 Use searchUsers instead (same implementation) - */ public function searchDisplayName(string $search, ?int $limit = null, ?int $offset = null): array { return $this->searchUsers($search, $limit, $offset); } - /** - * Get the names of the backend classes the group is connected to - * - * @return string[] - */ public function getBackendNames(): array { $backends = []; foreach ($this->backends as $backend) { @@ -299,11 +251,6 @@ class Group implements IGroup { return $backends; } - /** - * Delete the group - * - * @return bool - */ public function delete(): bool { // Prevent users from deleting group admin if ($this->getGID() === 'admin') { @@ -345,10 +292,6 @@ class Group implements IGroup { return $users; } - /** - * @return bool - * @since 14.0.0 - */ public function canRemoveUser(): bool { foreach ($this->backends as $backend) { if ($backend->implementsActions(GroupInterface::REMOVE_FROM_GOUP)) { @@ -358,10 +301,6 @@ class Group implements IGroup { return false; } - /** - * @return bool - * @since 14.0.0 - */ public function canAddUser(): bool { foreach ($this->backends as $backend) { if ($backend->implementsActions(GroupInterface::ADD_TO_GROUP)) { @@ -371,10 +310,6 @@ class Group implements IGroup { return false; } - /** - * @return bool - * @since 16.0.0 - */ public function hideFromCollaboration(): bool { return array_reduce($this->backends, function (bool $hide, GroupInterface $backend) { return $hide | ($backend instanceof IHideFromCollaborationBackend && $backend->hideGroup($this->gid)); diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index d18c7796805..b0b5e71174f 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -77,12 +77,6 @@ class Manager extends PublicEmitter implements IGroupManager { }); } - /** - * Checks whether a given backend is used - * - * @param string $backendClass Full classname including complete namespace - * @return bool - */ public function isBackendUsed($backendClass) { $backendClass = strtolower(ltrim($backendClass, '\\')); @@ -95,9 +89,6 @@ class Manager extends PublicEmitter implements IGroupManager { return false; } - /** - * @param \OCP\GroupInterface $backend - */ public function addBackend($backend) { $this->backends[] = $backend; $this->clearCaches(); @@ -108,11 +99,6 @@ class Manager extends PublicEmitter implements IGroupManager { $this->clearCaches(); } - /** - * Get the active backends - * - * @return \OCP\GroupInterface[] - */ public function getBackends() { return $this->backends; } @@ -123,10 +109,6 @@ class Manager extends PublicEmitter implements IGroupManager { $this->cachedUserGroups = []; } - /** - * @param string $gid - * @return IGroup|null - */ public function get($gid) { if (isset($this->cachedGroups[$gid])) { return $this->cachedGroups[$gid]; @@ -220,18 +202,10 @@ class Manager extends PublicEmitter implements IGroupManager { return $groups; } - /** - * @param string $gid - * @return bool - */ public function groupExists($gid) { return $this->get($gid) instanceof IGroup; } - /** - * @param string $gid - * @return IGroup|null - */ public function createGroup($gid) { if ($gid === '' || $gid === null) { return null; @@ -264,12 +238,6 @@ class Manager extends PublicEmitter implements IGroupManager { } } - /** - * @param string $search - * @param ?int $limit - * @param ?int $offset - * @return \OC\Group\Group[] - */ public function search(string $search, ?int $limit = null, ?int $offset = 0) { $groups = []; foreach ($this->backends as $backend) { @@ -285,10 +253,6 @@ class Manager extends PublicEmitter implements IGroupManager { return array_values($groups); } - /** - * @param IUser|null $user - * @return \OC\Group\Group[] - */ public function getUserGroups(?IUser $user = null) { if (!$user instanceof IUser) { return []; @@ -315,12 +279,6 @@ class Manager extends PublicEmitter implements IGroupManager { return $groups; } - /** - * Checks if a userId is in the admin group - * - * @param string $userId - * @return bool if admin - */ public function isAdmin($userId) { if (!$this->remoteAddress->allowsAdminActions()) { return false; @@ -346,23 +304,10 @@ class Manager extends PublicEmitter implements IGroupManager { return in_array(\OCA\Settings\Settings\Admin\Users::class, $authorizedClasses, true); } - /** - * Checks if a userId is in a group - * - * @param string $userId - * @param string $group - * @return bool if in group - */ public function isInGroup($userId, $group) { return in_array($group, $this->getUserIdGroupIds($userId)); } - /** - * get a list of group ids for a user - * - * @param IUser $user - * @return string[] with group ids - */ public function getUserGroupIds(IUser $user): array { return $this->getUserIdGroupIds($user->getUID()); } @@ -385,10 +330,6 @@ class Manager extends PublicEmitter implements IGroupManager { return $this->cachedUserGroups[$uid]; } - /** - * @param string $groupId - * @return ?string - */ public function getDisplayName(string $groupId): ?string { return $this->displayNameCache->getDisplayName($groupId); } @@ -405,15 +346,6 @@ class Manager extends PublicEmitter implements IGroupManager { }, $this->getUserGroups($user)); } - /** - * get a list of all display names in a group - * - * @param string $gid - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of display names (value) and user ids (key) - */ public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { $group = $this->get($gid); if (is_null($group)) { diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index 0b72522c218..68b101cc41a 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -171,35 +171,6 @@ class Client implements IClient { } } - /** - * Sends a GET request - * - * @param string $uri - * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function get(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('get', $uri, $this->buildRequestOptions($options)); @@ -207,65 +178,12 @@ class Client implements IClient { return new Response($response, $isStream); } - /** - * Sends a HEAD request - * - * @param string $uri - * @param array $options Array such as - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function head(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('head', $uri, $this->buildRequestOptions($options)); return new Response($response); } - /** - * Sends a POST request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function post(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); @@ -278,154 +196,30 @@ class Client implements IClient { return new Response($response, $isStream); } - /** - * Sends a PUT request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function put(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('put', $uri, $this->buildRequestOptions($options)); return new Response($response); } - /** - * Sends a PATCH request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function patch(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('patch', $uri, $this->buildRequestOptions($options)); return new Response($response); } - /** - * Sends a DELETE request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function delete(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('delete', $uri, $this->buildRequestOptions($options)); return new Response($response); } - /** - * Sends an OPTIONS request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function options(string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request('options', $uri, $this->buildRequestOptions($options)); return new Response($response); } - /** - * Get the response of a Throwable thrown by the request methods when possible - * - * @param \Throwable $e - * @return IResponse - * @throws \Throwable When $e did not have a response - * @since 29.0.0 - */ public function getResponseFromThrowable(\Throwable $e): IResponse { if (method_exists($e, 'hasResponse') && method_exists($e, 'getResponse') && $e->hasResponse()) { return new Response($e->getResponse()); @@ -434,36 +228,6 @@ class Client implements IClient { throw $e; } - /** - * Sends a HTTP request - * - * @param string $method The HTTP method to use - * @param string $uri - * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IResponse - * @throws \Exception If the request could not get completed - */ public function request(string $method, string $uri, array $options = []): IResponse { $this->preventLocalAddress($uri, $options); $response = $this->client->request($method, $uri, $this->buildRequestOptions($options)); @@ -478,97 +242,18 @@ class Client implements IClient { ); } - /** - * Sends an asynchronous GET request - * - * @param string $uri - * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IPromise - */ public function getAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('get', $uri, $this->buildRequestOptions($options)); return $this->wrapGuzzlePromise($response); } - /** - * Sends an asynchronous HEAD request - * - * @param string $uri - * @param array $options Array such as - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IPromise - */ public function headAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('head', $uri, $this->buildRequestOptions($options)); return $this->wrapGuzzlePromise($response); } - /** - * Sends an asynchronous POST request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IPromise - */ public function postAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); @@ -580,102 +265,18 @@ class Client implements IClient { return $this->wrapGuzzlePromise($this->client->requestAsync('post', $uri, $this->buildRequestOptions($options))); } - /** - * Sends an asynchronous PUT request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IPromise - */ public function putAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('put', $uri, $this->buildRequestOptions($options)); return $this->wrapGuzzlePromise($response); } - /** - * Sends an asynchronous DELETE request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IPromise - */ public function deleteAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('delete', $uri, $this->buildRequestOptions($options)); return $this->wrapGuzzlePromise($response); } - /** - * Sends an asynchronous OPTIONS request - * - * @param string $uri - * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, - * @return IPromise - */ public function optionsAsync(string $uri, array $options = []): IPromise { $this->preventLocalAddress($uri, $options); $response = $this->client->requestAsync('options', $uri, $this->buildRequestOptions($options)); diff --git a/lib/private/Http/Client/ClientService.php b/lib/private/Http/Client/ClientService.php index b719f3d369d..e30749949ad 100644 --- a/lib/private/Http/Client/ClientService.php +++ b/lib/private/Http/Client/ClientService.php @@ -51,9 +51,6 @@ class ClientService implements IClientService { $this->eventLogger = $eventLogger; } - /** - * @return Client - */ public function newClient(): IClient { $handler = new CurlHandler(); $stack = HandlerStack::create($handler); diff --git a/lib/private/Http/Client/GuzzlePromiseAdapter.php b/lib/private/Http/Client/GuzzlePromiseAdapter.php index 03a9ed9a599..b147a93c09e 100644 --- a/lib/private/Http/Client/GuzzlePromiseAdapter.php +++ b/lib/private/Http/Client/GuzzlePromiseAdapter.php @@ -9,12 +9,9 @@ declare(strict_types=1); namespace OC\Http\Client; -use Exception; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Promise\PromiseInterface; -use LogicException; use OCP\Http\Client\IPromise; -use OCP\Http\Client\IResponse; use Psr\Http\Message\ResponseInterface; use Psr\Log\LoggerInterface; @@ -31,16 +28,6 @@ class GuzzlePromiseAdapter implements IPromise { ) { } - /** - * Appends fulfillment and rejection handlers to the promise, and returns - * a new promise resolving to the return value of the called handler. - * - * @param ?callable(IResponse): void $onFulfilled Invoked when the promise fulfills. Gets an \OCP\Http\Client\IResponse passed in as argument - * @param ?callable(Exception): void $onRejected Invoked when the promise is rejected. Gets an \Exception passed in as argument - * - * @return IPromise - * @since 28.0.0 - */ public function then( ?callable $onFulfilled = null, ?callable $onRejected = null, @@ -65,15 +52,6 @@ class GuzzlePromiseAdapter implements IPromise { return $this; } - /** - * Get the state of the promise ("pending", "rejected", or "fulfilled"). - * - * The three states can be checked against the constants defined: - * STATE_PENDING, STATE_FULFILLED, and STATE_REJECTED. - * - * @return IPromise::STATE_* - * @since 28.0.0 - */ public function getState(): string { $state = $this->promise->getState(); if ($state === PromiseInterface::FULFILLED) { @@ -92,32 +70,10 @@ class GuzzlePromiseAdapter implements IPromise { return self::STATE_PENDING; } - /** - * Cancels the promise if possible. - * - * @link https://github.com/promises-aplus/cancellation-spec/issues/7 - * @since 28.0.0 - */ public function cancel(): void { $this->promise->cancel(); } - /** - * Waits until the promise completes if possible. - * - * Pass $unwrap as true to unwrap the result of the promise, either - * returning the resolved value or throwing the rejected exception. - * - * If the promise cannot be waited on, then the promise will be rejected. - * - * @param bool $unwrap - * - * @return mixed - * - * @throws LogicException if the promise has no wait function or if the - * promise does not settle after waiting. - * @since 28.0.0 - */ public function wait(bool $unwrap = true): mixed { return $this->promise->wait($unwrap); } diff --git a/lib/private/Http/Client/Response.php b/lib/private/Http/Client/Response.php index adf83306d07..09b668b61ee 100644 --- a/lib/private/Http/Client/Response.php +++ b/lib/private/Http/Client/Response.php @@ -34,26 +34,16 @@ class Response implements IResponse { $this->stream = $stream; } - /** - * @return string|resource - */ public function getBody() { return $this->stream ? $this->response->getBody()->detach(): $this->response->getBody()->getContents(); } - /** - * @return int - */ public function getStatusCode(): int { return $this->response->getStatusCode(); } - /** - * @param string $key - * @return string - */ public function getHeader(string $key): string { $headers = $this->response->getHeader($key); @@ -64,9 +54,6 @@ class Response implements IResponse { return $headers[0]; } - /** - * @return array - */ public function getHeaders(): array { return $this->response->getHeaders(); } diff --git a/lib/private/Image.php b/lib/private/Image.php index 3dd0bc49662..28ae8322227 100644 --- a/lib/private/Image.php +++ b/lib/private/Image.php @@ -61,12 +61,6 @@ class Image implements IImage { } } - /** - * Determine whether the object contains an image resource. - * - * @psalm-assert-if-true \GdImage $this->resource - * @return bool - */ public function valid(): bool { if (is_object($this->resource) && get_class($this->resource) === \GdImage::class) { return true; @@ -75,20 +69,10 @@ class Image implements IImage { return false; } - /** - * Returns the MIME type of the image or null if no image is loaded. - * - * @return string - */ public function mimeType(): ?string { return $this->valid() ? $this->mimeType : null; } - /** - * Returns the width of the image or -1 if no image is loaded. - * - * @return int - */ public function width(): int { if ($this->valid()) { return imagesx($this->resource); @@ -96,11 +80,6 @@ class Image implements IImage { return -1; } - /** - * Returns the height of the image or -1 if no image is loaded. - * - * @return int - */ public function height(): int { if ($this->valid()) { return imagesy($this->resource); @@ -108,11 +87,6 @@ class Image implements IImage { return -1; } - /** - * Returns the width when the image orientation is top-left. - * - * @return int - */ public function widthTopLeft(): int { $o = $this->getOrientation(); $this->logger->debug('Image->widthTopLeft() Orientation: ' . $o, ['app' => 'core']); @@ -132,11 +106,6 @@ class Image implements IImage { return $this->width(); } - /** - * Returns the height when the image orientation is top-left. - * - * @return int - */ public function heightTopLeft(): int { $o = $this->getOrientation(); $this->logger->debug('Image->heightTopLeft() Orientation: ' . $o, ['app' => 'core']); @@ -156,12 +125,6 @@ class Image implements IImage { return $this->height(); } - /** - * Outputs the image. - * - * @param string $mimeType - * @return bool - */ public function show(?string $mimeType = null): bool { if ($mimeType === null) { $mimeType = $this->mimeType(); @@ -172,14 +135,6 @@ class Image implements IImage { return $this->_output(null, $mimeType); } - /** - * Saves the image. - * - * @param string $filePath - * @param string $mimeType - * @return bool - */ - public function save(?string $filePath = null, ?string $mimeType = null): bool { if ($mimeType === null) { $mimeType = $this->mimeType(); @@ -293,16 +248,10 @@ class Image implements IImage { $this->resource = $resource; } - /** - * @return false|\GdImage Returns the image resource if any - */ public function resource() { return $this->resource; } - /** - * @return string Returns the mimetype of the data. Returns null if the data is not valid. - */ public function dataMimeType(): ?string { if (!$this->valid()) { return null; @@ -319,9 +268,6 @@ class Image implements IImage { } } - /** - * @return null|string Returns the raw image data. - */ public function data(): ?string { if (!$this->valid()) { return null; @@ -387,12 +333,6 @@ class Image implements IImage { return true; } - /** - * (I'm open for suggestions on better method name ;) - * Get the orientation based on EXIF data. - * - * @return int The orientation or -1 if no EXIF data is available. - */ public function getOrientation(): int { if ($this->exif !== null) { return $this->exif['Orientation']; @@ -439,12 +379,6 @@ class Image implements IImage { $this->exif = $exif; } - /** - * (I'm open for suggestions on better method name ;) - * Fixes orientation based on EXIF data. - * - * @return bool - */ public function fixOrientation(): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -778,9 +712,6 @@ class Image implements IImage { return $this->resource; } - /** - * @inheritDoc - */ public function loadFromData(string $str): GdImage|false { if (!$this->checkImageDataSize($str)) { return false; @@ -827,12 +758,6 @@ class Image implements IImage { } } - /** - * Resizes the image preserving ratio. - * - * @param int $maxSize The maximum size of either the width or height. - * @return bool - */ public function resize(int $maxSize): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -864,11 +789,6 @@ class Image implements IImage { return $this->preciseResizeNew((int)round($newWidth), (int)round($newHeight)); } - /** - * @param int $width - * @param int $height - * @return bool - */ public function preciseResize(int $width, int $height): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -917,12 +837,6 @@ class Image implements IImage { return $process; } - /** - * Crops the image to the middle square. If the image is already square it just returns. - * - * @param int $size maximum size for the result (optional) - * @return bool for success or failure - */ public function centerCrop(int $size = 0): bool { if (!$this->valid()) { $this->logger->debug('Image->centerCrop, No image loaded', ['app' => 'core']); @@ -977,15 +891,6 @@ class Image implements IImage { return true; } - /** - * Crops the image from point $x$y with dimension $wx$h. - * - * @param int $x Horizontal position - * @param int $y Vertical position - * @param int $w Width - * @param int $h Height - * @return bool for success or failure - */ public function crop(int $x, int $y, int $w, int $h): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -1036,15 +941,6 @@ class Image implements IImage { return $process; } - /** - * Resizes the image to fit within a boundary while preserving ratio. - * - * Warning: Images smaller than $maxWidth x $maxHeight will end up being scaled up - * - * @param int $maxWidth - * @param int $maxHeight - * @return bool - */ public function fitIn(int $maxWidth, int $maxHeight): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); @@ -1061,13 +957,6 @@ class Image implements IImage { return true; } - /** - * Shrinks larger images to fit within specified boundaries while preserving ratio. - * - * @param int $maxWidth - * @param int $maxHeight - * @return bool - */ public function scaleDownToFit(int $maxWidth, int $maxHeight): bool { if (!$this->valid()) { $this->logger->debug(__METHOD__ . '(): No image loaded', ['app' => 'core']); diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 6b6dc5d3b40..ce6ab141fcb 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -71,14 +71,6 @@ class Factory implements IFactory { $this->cache = $cacheFactory->createLocal('L10NFactory'); } - /** - * Get a language instance - * - * @param string $app - * @param string|null $lang - * @param string|null $locale - * @return \OCP\IL10N - */ public function get($app, $lang = null, $locale = null) { return new LazyL10N(function () use ($app, $lang, $locale) { $app = \OC_App::cleanAppId($app); @@ -118,13 +110,6 @@ class Factory implements IFactory { }); } - /** - * Find the best language - * - * @param string|null $appId App id or null for core - * - * @return string language If nothing works it returns 'en' - */ public function findLanguage(?string $appId = null): string { // Step 1: Forced language always has precedence over anything else $forceLang = $this->config->getSystemValue('force_language', false); @@ -219,12 +204,6 @@ class Factory implements IFactory { return 'en'; } - /** - * find the best locale - * - * @param string $lang - * @return null|string - */ public function findLocale($lang = null) { $forceLocale = $this->config->getSystemValue('force_locale', false); if (is_string($forceLocale) && $this->localeExists($forceLocale)) { @@ -261,13 +240,6 @@ class Factory implements IFactory { return 'en_US'; } - /** - * find the matching lang from the locale - * - * @param string $app - * @param string $locale - * @return null|string - */ public function findLanguageFromLocale(string $app = 'core', ?string $locale = null) { if ($this->languageExists($app, $locale)) { return $locale; @@ -280,12 +252,6 @@ class Factory implements IFactory { } } - /** - * Find all available languages for an app - * - * @param string|null $app App id or null for core - * @return string[] an array of available languages - */ public function findAvailableLanguages($app = null): array { $key = $app; if ($key === null) { @@ -336,9 +302,6 @@ class Factory implements IFactory { return $available; } - /** - * @return array|mixed - */ public function findAvailableLocales() { if (!empty($this->availableLocales)) { return $this->availableLocales; @@ -350,11 +313,6 @@ class Factory implements IFactory { return $this->availableLocales; } - /** - * @param string|null $app App id or null for core - * @param string $lang - * @return bool - */ public function languageExists($app, $lang) { if ($lang === 'en') { //english is always available return true; @@ -372,13 +330,6 @@ class Factory implements IFactory { return new LanguageIterator($user, $this->config); } - /** - * Return the language to use when sending something to a user - * - * @param IUser|null $user - * @return string - * @since 20.0.0 - */ public function getUserLanguage(?IUser $user = null): string { $language = $this->config->getSystemValue('force_language', false); if ($language !== false) { @@ -404,10 +355,6 @@ class Factory implements IFactory { return $this->config->getSystemValueString('default_language', 'en'); } - /** - * @param string $locale - * @return bool - */ public function localeExists($locale) { if ($locale === 'en') { //english is always available return true; @@ -557,9 +504,6 @@ class Factory implements IFactory { return $this->serverRoot . '/core/l10n/'; } - /** - * @inheritDoc - */ public function getLanguages(): array { $forceLanguage = $this->config->getSystemValue('force_language', false); if ($forceLanguage !== false) { diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index 50db373a65d..f303ed4be77 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -51,33 +51,14 @@ class L10N implements IL10N { } } - /** - * The code (en, de, ...) of the language that is used for this instance - * - * @return string language - */ public function getLanguageCode(): string { return $this->lang; } - /** - * The code (en_US, fr_CA, ...) of the locale that is used for this instance - * - * @return string locale - */ public function getLocaleCode(): string { return $this->locale; } - /** - * Translating - * @param string $text The text we need a translation for - * @param array|string $parameters default:array() Parameters for sprintf - * @return string Translation or the same text - * - * Returns the translation. If no translation is found, $text will be - * returned. - */ public function t(string $text, $parameters = []): string { if (!\is_array($parameters)) { $parameters = [$parameters]; @@ -86,21 +67,6 @@ class L10N implements IL10N { return (string)new L10NString($this, $text, $parameters); } - /** - * Translating - * @param string $text_singular the string to translate for exactly one object - * @param string $text_plural the string to translate for n objects - * @param integer $count Number of objects - * @param array $parameters default:array() Parameters for sprintf - * @return string Translation or the same text - * - * Returns the translation. If no translation is found, $text will be - * returned. %n will be replaced with the number of objects. - * - * The correct plural is determined by the plural_forms-function - * provided by the po file. - * - */ public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { $identifier = "_{$text_singular}_::_{$text_plural}_"; if (isset($this->translations[$identifier])) { @@ -114,28 +80,6 @@ class L10N implements IL10N { return (string)new L10NString($this, $text_plural, $parameters, $count); } - /** - * Localization - * @param string $type Type of localization - * @param \DateTime|int|string $data parameters for this localization - * @param array $options - * @return string|int|false - * - * Returns the localized data. - * - * Implemented types: - * - date - * - Creates a date - * - params: timestamp (int/string) - * - datetime - * - Creates date and time - * - params: timestamp (int/string) - * - time - * - Creates a time - * - params: timestamp (int/string) - * - firstday: Returns the first day of the week (0 sunday - 6 saturday) - * - jsdate: Returns the short JS date format - */ public function l(string $type, $data = null, array $options = []) { if ($this->locale === null) { // Use the language of the instance diff --git a/lib/private/L10N/LanguageIterator.php b/lib/private/L10N/LanguageIterator.php index 531eea5866b..5b5d01f6e98 100644 --- a/lib/private/L10N/LanguageIterator.php +++ b/lib/private/L10N/LanguageIterator.php @@ -24,18 +24,10 @@ class LanguageIterator implements ILanguageIterator { $this->user = $user; } - /** - * Rewind the Iterator to the first element - */ public function rewind(): void { $this->i = 0; } - /** - * Return the current element - * - * @since 14.0.0 - */ public function current(): string { switch ($this->i) { /** @noinspection PhpMissingBreakStatementInspection */ @@ -89,29 +81,14 @@ class LanguageIterator implements ILanguageIterator { } } - /** - * Move forward to next element - * - * @since 14.0.0 - */ public function next(): void { ++$this->i; } - /** - * Return the key of the current element - * - * @since 14.0.0 - */ public function key(): int { return $this->i; } - /** - * Checks if current position is valid - * - * @since 14.0.0 - */ public function valid(): bool { return $this->i <= 6; } diff --git a/lib/private/Lock/AbstractLockingProvider.php b/lib/private/Lock/AbstractLockingProvider.php index aa203f6a90b..f133c211b5b 100644 --- a/lib/private/Lock/AbstractLockingProvider.php +++ b/lib/private/Lock/AbstractLockingProvider.php @@ -76,7 +76,6 @@ abstract class AbstractLockingProvider implements ILockingProvider { } } - /** @inheritDoc */ public function releaseAll(): void { foreach ($this->acquiredLocks['shared'] as $path => $count) { for ($i = 0; $i < $count; $i++) { diff --git a/lib/private/Lock/NoopLockingProvider.php b/lib/private/Lock/NoopLockingProvider.php index 42f1f9ae5ec..c7f6afb6b2b 100644 --- a/lib/private/Lock/NoopLockingProvider.php +++ b/lib/private/Lock/NoopLockingProvider.php @@ -16,37 +16,22 @@ use OCP\Lock\ILockingProvider; * To be used when locking is disabled. */ class NoopLockingProvider implements ILockingProvider { - /** - * {@inheritdoc} - */ public function isLocked(string $path, int $type): bool { return false; } - /** - * {@inheritdoc} - */ public function acquireLock(string $path, int $type, ?string $readablePath = null): void { // do nothing } - /** - * {@inheritdoc} - */ public function releaseLock(string $path, int $type): void { // do nothing } - /**1 - * {@inheritdoc} - */ public function releaseAll(): void { // do nothing } - /** - * {@inheritdoc} - */ public function changeLock(string $path, int $targetType): void { // do nothing } diff --git a/lib/private/Log.php b/lib/private/Log.php index 4f6003cf53d..a15c6f3006a 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -8,7 +8,6 @@ declare(strict_types=1); */ namespace OC; -use Exception; use Nextcloud\LogNormalizer\Normalizer; use OC\AppFramework\Bootstrap\Coordinator; use OC\Log\ExceptionSerializer; @@ -50,105 +49,39 @@ class Log implements ILogger, IDataLogger { $this->eventDispatcher = $eventDispatcher; } - /** - * System is unusable. - * - * @param string $message - * @param array $context - */ public function emergency(string $message, array $context = []): void { $this->log(ILogger::FATAL, $message, $context); } - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - */ public function alert(string $message, array $context = []): void { $this->log(ILogger::ERROR, $message, $context); } - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - */ public function critical(string $message, array $context = []): void { $this->log(ILogger::ERROR, $message, $context); } - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - */ public function error(string $message, array $context = []): void { $this->log(ILogger::ERROR, $message, $context); } - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - */ public function warning(string $message, array $context = []): void { $this->log(ILogger::WARN, $message, $context); } - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - */ public function notice(string $message, array $context = []): void { $this->log(ILogger::INFO, $message, $context); } - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - */ public function info(string $message, array $context = []): void { $this->log(ILogger::INFO, $message, $context); } - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - */ public function debug(string $message, array $context = []): void { $this->log(ILogger::DEBUG, $message, $context); } - /** - * Logs with an arbitrary level. - * - * @param int $level - * @param string $message - * @param array $context - */ public function log(int $level, string $message, array $context = []): void { $minLevel = $this->getLogLevel($context, $message); if ($level < $minLevel @@ -303,14 +236,6 @@ class Log implements ILogger, IDataLogger { return hash_equals($conditionSecret, $request->getParam('log_secret', '')); } - /** - * Logs an exception very detailed - * - * @param Exception|Throwable $exception - * @param array $context - * @return void - * @since 8.2.0 - */ public function logException(Throwable $exception, array $context = []): void { $app = $context['app'] ?? 'no app in context'; $level = $context['level'] ?? ILogger::ERROR; diff --git a/lib/private/Log/Errorlog.php b/lib/private/Log/Errorlog.php index d53b8b151a1..825d1f7ab40 100644 --- a/lib/private/Log/Errorlog.php +++ b/lib/private/Log/Errorlog.php @@ -20,11 +20,6 @@ class Errorlog extends LogDetails implements IWriter { parent::__construct($config); } - /** - * Write a message in the log - * - * @param string|array $message - */ public function write(string $app, $message, int $level): void { error_log('[' . $this->tag . ']['.$app.']['.$level.'] '.$this->logDetailsAsJSON($app, $message, $level)); } diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php index bc14de4ffdf..3e29001789b 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -44,10 +44,6 @@ class File extends LogDetails implements IWriter, IFileBased { $this->logFileMode = $config->getValue('logfilemode', 0640); } - /** - * write a message in the log - * @param string|array $message - */ public function write(string $app, $message, int $level): void { $entry = $this->logDetailsAsJSON($app, $message, $level); $handle = @fopen($this->logFile, 'a'); @@ -69,9 +65,6 @@ class File extends LogDetails implements IWriter, IFileBased { } } - /** - * get entries from the log in reverse chronological order - */ public function getEntries(int $limit = 50, int $offset = 0): array { $minLevel = $this->config->getValue('loglevel', ILogger::WARN); $entries = []; diff --git a/lib/private/Log/LogFactory.php b/lib/private/Log/LogFactory.php index a5a7290bd9c..05275d8e79e 100644 --- a/lib/private/Log/LogFactory.php +++ b/lib/private/Log/LogFactory.php @@ -20,9 +20,6 @@ class LogFactory implements ILogFactory { ) { } - /** - * @throws \OCP\AppFramework\QueryException - */ public function get(string $type):IWriter { return match (strtolower($type)) { 'errorlog' => new Errorlog($this->systemConfig), diff --git a/lib/private/Log/Syslog.php b/lib/private/Log/Syslog.php index bd2c39509b1..19388abbde9 100644 --- a/lib/private/Log/Syslog.php +++ b/lib/private/Log/Syslog.php @@ -35,10 +35,6 @@ class Syslog extends LogDetails implements IWriter { closelog(); } - /** - * write a message in the log - * @param string|array $message - */ public function write(string $app, $message, int $level): void { $syslog_level = $this->levels[$level]; syslog($syslog_level, $this->logDetailsAsJSON($app, $message, $level)); diff --git a/lib/private/Log/Systemdlog.php b/lib/private/Log/Systemdlog.php index 4e33a4e5419..6f65ce67e42 100644 --- a/lib/private/Log/Systemdlog.php +++ b/lib/private/Log/Systemdlog.php @@ -52,10 +52,6 @@ class Systemdlog extends LogDetails implements IWriter { $this->syslogId = $tag; } - /** - * Write a message to the log. - * @param string|array $message - */ public function write(string $app, $message, int $level): void { $journal_level = $this->levels[$level]; sd_journal_send('PRIORITY='.$journal_level, diff --git a/lib/private/Mail/Attachment.php b/lib/private/Mail/Attachment.php index 8dede9714f8..0e5e601fd87 100644 --- a/lib/private/Mail/Attachment.php +++ b/lib/private/Mail/Attachment.php @@ -26,28 +26,16 @@ class Attachment implements IAttachment { ) { } - /** - * @return $this - * @since 13.0.0 - */ public function setFilename(string $filename): IAttachment { $this->name = $filename; return $this; } - /** - * @return $this - * @since 13.0.0 - */ public function setContentType(string $contentType): IAttachment { $this->contentType = $contentType; return $this; } - /** - * @return $this - * @since 13.0.0 - */ public function setBody(string $body): IAttachment { $this->body = $body; return $this; diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index 2cb222fd137..94deedfa9c8 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -316,16 +316,10 @@ EOF; $this->htmlBody .= $this->head; } - /** - * Sets the subject of the email - */ public function setSubject(string $subject): void { $this->subject = $subject; } - /** - * Adds a header to the email - */ public function addHeader(): void { if ($this->headerAdded) { return; @@ -342,12 +336,6 @@ EOF; $this->htmlBody .= vsprintf($this->header, [$this->themingDefaults->getDefaultColorPrimary(), $logoUrl, $this->themingDefaults->getName(), $logoSizeDimensions]); } - /** - * Adds a heading to the email - * - * @param string|bool $plainTitle Title that is used in the plain text email - * if empty the $title is used, if false none will be used - */ public function addHeading(string $title, $plainTitle = ''): void { if ($this->footerAdded) { return; @@ -374,13 +362,6 @@ EOF; $this->bodyOpened = true; } - /** - * Adds a paragraph to the body of the email - * - * @param string $text Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email - * @param string|bool $plainText Text that is used in the plain text email - * if empty the $text is used, if false none will be used - */ public function addBodyText(string $text, $plainText = ''): void { if ($this->footerAdded) { return; @@ -399,19 +380,6 @@ EOF; } } - /** - * Adds a list item to the body of the email - * - * @param string $text Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email - * @param string $metaInfo Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email - * @param string $icon Absolute path, must be 16*16 pixels - * @param string|bool $plainText Text that is used in the plain text email - * if empty or true the $text is used, if false none will be used - * @param string|bool $plainMetaInfo Meta info that is used in the plain text email - * if empty or true the $metaInfo is used, if false none will be used - * @param integer $plainIndent plainIndent If > 0, Indent plainText by this amount. - * @since 12.0.0 - */ public function addBodyListItem( string $text, string $metaInfo = '', @@ -488,16 +456,6 @@ EOF; $this->htmlBody .= $this->listEnd; } - /** - * Adds a button group of two buttons to the body of the email - * - * @param string $textLeft Text of left button; Note: When $plainTextLeft falls back to this, HTML is automatically escaped in the HTML email - * @param string $urlLeft URL of left button - * @param string $textRight Text of right button; Note: When $plainTextRight falls back to this, HTML is automatically escaped in the HTML email - * @param string $urlRight URL of right button - * @param string $plainTextLeft Text of left button that is used in the plain text version - if unset the $textLeft is used - * @param string $plainTextRight Text of right button that is used in the plain text version - if unset the $textRight is used - */ public function addBodyButtonGroup( string $textLeft, string $urlLeft, @@ -530,16 +488,6 @@ EOF; $this->plainBody .= $plainTextRight . ': ' . $urlRight . PHP_EOL . PHP_EOL; } - /** - * Adds a button to the body of the email - * - * @param string $text Text of button; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email - * @param string $url URL of button - * @param string|false $plainText Text of button in plain text version - * if empty the $text is used, if false none will be used - * - * @since 12.0.0 - */ public function addBodyButton(string $text, string $url, $plainText = ''): void { if ($this->footerAdded) { return; @@ -578,11 +526,6 @@ EOF; $this->bodyOpened = false; } - /** - * Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email - * - * @param string $text If the text is empty the default "Name - Slogan<br>This is an automatically sent email" will be used - */ public function addFooter(string $text = '', ?string $lang = null): void { if ($text === '') { $l10n = $this->l10nFactory->get('lib', $lang); @@ -606,16 +549,10 @@ EOF; $this->plainBody .= str_replace('<br>', PHP_EOL, $text); } - /** - * Returns the rendered email subject as string - */ public function renderSubject(): string { return $this->subject; } - /** - * Returns the rendered HTML email as string - */ public function renderHtml(): string { if (!$this->footerAdded) { $this->footerAdded = true; @@ -625,9 +562,6 @@ EOF; return $this->htmlBody; } - /** - * Returns the rendered plain text email as string - */ public function renderText(): string { if (!$this->footerAdded) { $this->footerAdded = true; diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index 0a818b847aa..c07ffd4ee78 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -71,37 +71,19 @@ class Mailer implements IMailer { ) { } - /** - * Creates a new message object that can be passed to send() - */ public function createMessage(): Message { $plainTextOnly = $this->config->getSystemValueBool('mail_send_plaintext_only', false); return new Message(new Email(), $plainTextOnly); } - /** - * @param string|null $data - * @param string|null $filename - * @param string|null $contentType - * @since 13.0.0 - */ public function createAttachment($data = null, $filename = null, $contentType = null): IAttachment { return new Attachment($data, $filename, $contentType); } - /** - * @param string|null $contentType - * @since 13.0.0 - */ public function createAttachmentFromPath(string $path, $contentType = null): IAttachment { return new Attachment(null, null, $contentType, $path); } - /** - * Creates a new email template object - * - * @since 12.0.0 - */ public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate { $logoDimensions = $this->config->getAppValue('theming', 'logoDimensions', self::DEFAULT_DIMENSIONS); if (str_contains($logoDimensions, 'x')) { @@ -153,16 +135,6 @@ class Mailer implements IMailer { ); } - /** - * Send the specified message. Also sets the from address to the value defined in config.php - * if no-one has been passed. - * - * If sending failed, the recipients that failed will be returned (to, cc and bcc). - * Will output additional debug info if 'mail_smtpdebug' => 'true' is set in config.php - * - * @param IMessage $message Message to send - * @return string[] $failedRecipients - */ public function send(IMessage $message): array { $debugMode = $this->config->getSystemValueBool('mail_smtpdebug', false); @@ -230,13 +202,6 @@ class Mailer implements IMailer { return []; } - /** - * @deprecated 26.0.0 Implicit validation is done in \OC\Mail\Message::setRecipients - * via \Symfony\Component\Mime\Address::__construct - * - * @param string $email Email address to be validated - * @return bool True if the mail address is valid, false otherwise - */ public function validateMailAddress(string $email): bool { if ($email === '') { // Shortcut: empty addresses are never valid diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index faeba469e20..24da27d4197 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -35,21 +35,12 @@ class Message implements IMessage { ) { } - /** - * @since 13.0.0 - * @return $this - */ public function attach(IAttachment $attachment): IMessage { /** @var Attachment $attachment */ $attachment->attach($this->symfonyEmail); return $this; } - /** - * Can be used to "attach content inline" as message parts with specific MIME type and encoding. - * {@inheritDoc} - * @since 26.0.0 - */ public function attachInline(string $body, string $name, ?string $contentType = null): IMessage { # To be sure this works with iCalendar messages, we encode with 8bit instead of # quoted-printable encoding. We save the current encoder, replace the current @@ -86,14 +77,6 @@ class Message implements IMessage { return $convertedAddresses; } - /** - * Set the from address of this message. - * - * If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php - * - * @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name') - * @return $this - */ public function setFrom(array $addresses): IMessage { $this->from = $addresses; return $this; @@ -106,10 +89,6 @@ class Message implements IMessage { return $this->from; } - /** - * Set the Reply-To address of this message - * @return $this - */ public function setReplyTo(array $addresses): IMessage { $this->replyTo = $addresses; return $this; @@ -122,12 +101,6 @@ class Message implements IMessage { return $this->replyTo; } - /** - * Set the to addresses of this message. - * - * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') - * @return $this - */ public function setTo(array $recipients): IMessage { $this->to = $recipients; return $this; @@ -140,12 +113,6 @@ class Message implements IMessage { return $this->to; } - /** - * Set the CC recipients of this message. - * - * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') - * @return $this - */ public function setCc(array $recipients): IMessage { $this->cc = $recipients; return $this; @@ -158,12 +125,6 @@ class Message implements IMessage { return $this->cc; } - /** - * Set the BCC recipients of this message. - * - * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') - * @return $this - */ public function setBcc(array $recipients): IMessage { $this->bcc = $recipients; return $this; @@ -176,9 +137,6 @@ class Message implements IMessage { return $this->bcc; } - /** - * @return $this - */ public function setSubject(string $subject): IMessage { $this->symfonyEmail->subject($subject); return $this; @@ -191,9 +149,6 @@ class Message implements IMessage { return $this->symfonyEmail->getSubject() ?? ''; } - /** - * @return $this - */ public function setPlainBody(string $body): IMessage { $this->symfonyEmail->text($body); return $this; @@ -208,9 +163,6 @@ class Message implements IMessage { return $body; } - /** - * @return $this - */ public function setHtmlBody(string $body): IMessage { if (!$this->plainTextOnly) { $this->symfonyEmail->html($body); @@ -272,9 +224,6 @@ class Message implements IMessage { $this->symfonyEmail->bcc(...$this->convertAddresses($this->getBcc())); } - /** - * @return $this - */ public function useTemplate(IEMailTemplate $emailTemplate): IMessage { $this->setSubject($emailTemplate->renderSubject()); $this->setPlainBody($emailTemplate->renderText()); @@ -284,13 +233,6 @@ class Message implements IMessage { return $this; } - /** - * Add the Auto-Submitted header to the email, preventing most automated - * responses to automated messages. - * - * @param AutoSubmitted::VALUE_* $value (one of AutoSubmitted::VALUE_NO, AutoSubmitted::VALUE_AUTO_GENERATED, AutoSubmitted::VALUE_AUTO_REPLIED) - * @return $this - */ public function setAutoSubmitted(string $value): IMessage { $headers = $this->symfonyEmail->getHeaders(); diff --git a/lib/private/Mail/Provider/Manager.php b/lib/private/Mail/Provider/Manager.php index 14ffeac287b..c0c90132cff 100644 --- a/lib/private/Mail/Provider/Manager.php +++ b/lib/private/Mail/Provider/Manager.php @@ -27,13 +27,6 @@ class Manager implements IManager { ) { } - /** - * Determine if any mail providers are registered - * - * @since 30.0.0 - * - * @return bool - */ public function has(): bool { // return true if collection has any providers @@ -41,13 +34,6 @@ class Manager implements IManager { } - /** - * Retrieve a count of how many mail providers are registered - * - * @since 30.0.0 - * - * @return int - */ public function count(): int { // return count of providers in collection @@ -55,13 +41,6 @@ class Manager implements IManager { } - /** - * Retrieve which mail providers are registered - * - * @since 30.0.0 - * - * @return array<string,string> collection of provider id and label ['jmap' => 'JMap Connector'] - */ public function types(): array { // construct types collection @@ -75,13 +54,6 @@ class Manager implements IManager { } - /** - * Retrieve all registered mail providers - * - * @since 30.0.0 - * - * @return array<string,IProvider> collection of provider id and object ['jmap' => IProviderObject] - */ public function providers(): array { // evaluate if we already have a cached collection of providers and return the collection if we do @@ -116,15 +88,6 @@ class Manager implements IManager { } - /** - * Retrieve a provider with a specific id - * - * @since 30.0.0 - * - * @param string $providerId provider id - * - * @return IProvider|null - */ public function findProviderById(string $providerId): IProvider|null { // evaluate if we already have a cached collection of providers @@ -140,15 +103,6 @@ class Manager implements IManager { } - /** - * Retrieve all services for all registered mail providers - * - * @since 30.0.0 - * - * @param string $userId user id - * - * @return array<string,array<string,IService>> collection of provider id, service id and object ['jmap' => ['Service1' => IServiceObject]] - */ public function services(string $userId): array { // initilize collection @@ -167,17 +121,6 @@ class Manager implements IManager { } - /** - * Retrieve a service with a specific id - * - * @since 30.0.0 - * - * @param string $userId user id - * @param string $serviceId service id - * @param string $providerId provider id - * - * @return IService|null returns service object or null if none found - */ public function findServiceById(string $userId, string $serviceId, ?string $providerId = null): IService|null { // evaluate if provider id was specified @@ -210,18 +153,6 @@ class Manager implements IManager { } - /** - * Retrieve a service for a specific mail address - * returns first service with specific primary address - * - * @since 30.0.0 - * - * @param string $userId user id - * @param string $address mail address (e.g. test@example.com) - * @param string $providerId provider id - * - * @return IService|null returns service object or null if none found - */ public function findServiceByAddress(string $userId, string $address, ?string $providerId = null): IService|null { // evaluate if provider id was specified diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php index 024462d227b..a3699363965 100644 --- a/lib/private/Memcache/APCu.php +++ b/lib/private/Memcache/APCu.php @@ -50,14 +50,6 @@ class APCu extends Cache implements IMemcache { return apcu_delete($iter); } - /** - * Set a value in the cache if it's not already stored - * - * @param string $key - * @param mixed $value - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 - * @return bool - */ public function add($key, $value, $ttl = 0) { if ($ttl === 0) { $ttl = self::DEFAULT_TTL; @@ -65,39 +57,17 @@ class APCu extends Cache implements IMemcache { return apcu_add($this->getPrefix() . $key, $value, $ttl); } - /** - * Increase a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function inc($key, $step = 1) { $success = null; return apcu_inc($this->getPrefix() . $key, $step, $success, self::DEFAULT_TTL); } - /** - * Decrease a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function dec($key, $step = 1) { return apcu_exists($this->getPrefix() . $key) ? apcu_dec($this->getPrefix() . $key, $step) : false; } - /** - * Compare and set - * - * @param string $key - * @param mixed $old - * @param mixed $new - * @return bool - */ public function cas($key, $old, $new) { // apc only does cas for ints if (is_int($old) and is_int($new)) { diff --git a/lib/private/Memcache/ArrayCache.php b/lib/private/Memcache/ArrayCache.php index 4cac60c272c..c6064df3297 100644 --- a/lib/private/Memcache/ArrayCache.php +++ b/lib/private/Memcache/ArrayCache.php @@ -14,9 +14,6 @@ class ArrayCache extends Cache implements IMemcache { use CADTrait; - /** - * {@inheritDoc} - */ public function get($key) { if ($this->hasKey($key)) { return $this->cachedData[$key]; @@ -24,32 +21,20 @@ class ArrayCache extends Cache implements IMemcache { return null; } - /** - * {@inheritDoc} - */ public function set($key, $value, $ttl = 0) { $this->cachedData[$key] = $value; return true; } - /** - * {@inheritDoc} - */ public function hasKey($key) { return isset($this->cachedData[$key]); } - /** - * {@inheritDoc} - */ public function remove($key) { unset($this->cachedData[$key]); return true; } - /** - * {@inheritDoc} - */ public function clear($prefix = '') { if ($prefix === '') { $this->cachedData = []; @@ -64,14 +49,6 @@ class ArrayCache extends Cache implements IMemcache { return true; } - /** - * Set a value in the cache if it's not already stored - * - * @param string $key - * @param mixed $value - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 - * @return bool - */ public function add($key, $value, $ttl = 0) { // since this cache is not shared race conditions aren't an issue if ($this->hasKey($key)) { @@ -81,13 +58,6 @@ class ArrayCache extends Cache implements IMemcache { } } - /** - * Increase a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function inc($key, $step = 1) { $oldValue = $this->get($key); if (is_int($oldValue)) { @@ -99,13 +69,6 @@ class ArrayCache extends Cache implements IMemcache { } } - /** - * Decrease a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function dec($key, $step = 1) { $oldValue = $this->get($key); if (is_int($oldValue)) { @@ -116,14 +79,6 @@ class ArrayCache extends Cache implements IMemcache { } } - /** - * Compare and set - * - * @param string $key - * @param mixed $old - * @param mixed $new - * @return bool - */ public function cas($key, $old, $new) { if ($this->get($key) === $old) { return $this->set($key, $new); @@ -132,9 +87,6 @@ class ArrayCache extends Cache implements IMemcache { } } - /** - * {@inheritDoc} - */ public static function isAvailable(): bool { return true; } diff --git a/lib/private/Memcache/Cache.php b/lib/private/Memcache/Cache.php index 2a2a6e2a23f..a8562523504 100644 --- a/lib/private/Memcache/Cache.php +++ b/lib/private/Memcache/Cache.php @@ -29,36 +29,14 @@ abstract class Cache implements \ArrayAccess, \OCP\ICache { return $this->prefix; } - /** - * @param string $key - * @return mixed - */ abstract public function get($key); - /** - * @param string $key - * @param mixed $value - * @param int $ttl - * @return mixed - */ abstract public function set($key, $value, $ttl = 0); - /** - * @param string $key - * @return mixed - */ abstract public function hasKey($key); - /** - * @param string $key - * @return mixed - */ abstract public function remove($key); - /** - * @param string $prefix - * @return mixed - */ abstract public function clear($prefix = ''); //implement the ArrayAccess interface diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php index 931c871d0f1..266aa014e85 100644 --- a/lib/private/Memcache/Factory.php +++ b/lib/private/Memcache/Factory.php @@ -99,12 +99,6 @@ class Factory implements ICacheFactory { return $this->globalPrefix; } - /** - * create a cache instance for storing locks - * - * @param string $prefix - * @return IMemcache - */ public function createLocking(string $prefix = ''): IMemcache { $globalPrefix = $this->getGlobalPrefix(); if (is_null($globalPrefix)) { @@ -126,12 +120,6 @@ class Factory implements ICacheFactory { return $cache; } - /** - * create a distributed cache instance - * - * @param string $prefix - * @return ICache - */ public function createDistributed(string $prefix = ''): ICache { $globalPrefix = $this->getGlobalPrefix(); if (is_null($globalPrefix)) { @@ -153,12 +141,6 @@ class Factory implements ICacheFactory { return $cache; } - /** - * create a local cache instance - * - * @param string $prefix - * @return ICache - */ public function createLocal(string $prefix = ''): ICache { $globalPrefix = $this->getGlobalPrefix(); if (is_null($globalPrefix)) { @@ -180,11 +162,6 @@ class Factory implements ICacheFactory { return $cache; } - /** - * check memcache availability - * - * @return bool - */ public function isAvailable(): bool { return $this->distributedCacheClass !== self::NULL_CACHE; } @@ -193,11 +170,6 @@ class Factory implements ICacheFactory { return new CappedMemoryCache($capacity); } - /** - * Check if a local memory cache backend is available - * - * @return bool - */ public function isLocalCacheAvailable(): bool { return $this->localCacheClass !== self::NULL_CACHE; } diff --git a/lib/private/Memcache/LoggerWrapperCache.php b/lib/private/Memcache/LoggerWrapperCache.php index c2a06731910..9fd7c8d48fa 100644 --- a/lib/private/Memcache/LoggerWrapperCache.php +++ b/lib/private/Memcache/LoggerWrapperCache.php @@ -40,7 +40,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->prefix; } - /** @inheritDoc */ public function get($key) { file_put_contents( $this->logFile, @@ -50,7 +49,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->get($key); } - /** @inheritDoc */ public function set($key, $value, $ttl = 0) { file_put_contents( $this->logFile, @@ -61,7 +59,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->set($key, $value, $ttl); } - /** @inheritDoc */ public function hasKey($key) { file_put_contents( $this->logFile, @@ -72,7 +69,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->hasKey($key); } - /** @inheritDoc */ public function remove($key) { file_put_contents( $this->logFile, @@ -83,7 +79,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->remove($key); } - /** @inheritDoc */ public function clear($prefix = '') { file_put_contents( $this->logFile, @@ -94,7 +89,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->clear($prefix); } - /** @inheritDoc */ public function add($key, $value, $ttl = 0) { file_put_contents( $this->logFile, @@ -105,7 +99,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->add($key, $value, $ttl); } - /** @inheritDoc */ public function inc($key, $step = 1) { file_put_contents( $this->logFile, @@ -116,7 +109,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->inc($key, $step); } - /** @inheritDoc */ public function dec($key, $step = 1) { file_put_contents( $this->logFile, @@ -127,7 +119,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->dec($key, $step); } - /** @inheritDoc */ public function cas($key, $old, $new) { file_put_contents( $this->logFile, @@ -138,7 +129,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->cas($key, $old, $new); } - /** @inheritDoc */ public function cad($key, $old) { file_put_contents( $this->logFile, @@ -149,7 +139,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->cad($key, $old); } - /** @inheritDoc */ public function ncad(string $key, mixed $old): bool { file_put_contents( $this->logFile, @@ -160,7 +149,6 @@ class LoggerWrapperCache extends Cache implements IMemcacheTTL { return $this->wrappedCache->cad($key, $old); } - /** @inheritDoc */ public function setTTL(string $key, int $ttl) { $this->wrappedCache->setTTL($key, $ttl); } diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index 620013feda6..7396e31e7c7 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -113,26 +113,11 @@ class Memcached extends Cache implements IMemcache { return true; } - /** - * Set a value in the cache if it's not already stored - * - * @param string $key - * @param mixed $value - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 - * @return bool - */ public function add($key, $value, $ttl = 0) { $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); return $result || $this->isSuccess(); } - /** - * Increase a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function inc($key, $step = 1) { $this->add($key, 0); $result = self::$cache->increment($this->getPrefix() . $key, $step); @@ -144,13 +129,6 @@ class Memcached extends Cache implements IMemcache { return $result; } - /** - * Decrease a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function dec($key, $step = 1) { $result = self::$cache->decrement($this->getPrefix() . $key, $step); diff --git a/lib/private/Memcache/ProfilerWrapperCache.php b/lib/private/Memcache/ProfilerWrapperCache.php index 97d9d828a32..4a7765ced74 100644 --- a/lib/private/Memcache/ProfilerWrapperCache.php +++ b/lib/private/Memcache/ProfilerWrapperCache.php @@ -40,7 +40,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $this->prefix; } - /** @inheritDoc */ public function get($key) { $start = microtime(true); $ret = $this->wrappedCache->get($key); @@ -58,7 +57,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function set($key, $value, $ttl = 0) { $start = microtime(true); $ret = $this->wrappedCache->set($key, $value, $ttl); @@ -70,7 +68,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function hasKey($key) { $start = microtime(true); $ret = $this->wrappedCache->hasKey($key); @@ -82,7 +79,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function remove($key) { $start = microtime(true); $ret = $this->wrappedCache->remove($key); @@ -94,7 +90,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function clear($prefix = '') { $start = microtime(true); $ret = $this->wrappedCache->clear($prefix); @@ -106,7 +101,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function add($key, $value, $ttl = 0) { $start = microtime(true); $ret = $this->wrappedCache->add($key, $value, $ttl); @@ -118,7 +112,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function inc($key, $step = 1) { $start = microtime(true); $ret = $this->wrappedCache->inc($key, $step); @@ -130,7 +123,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function dec($key, $step = 1) { $start = microtime(true); $ret = $this->wrappedCache->dec($key, $step); @@ -142,7 +134,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function cas($key, $old, $new) { $start = microtime(true); $ret = $this->wrappedCache->cas($key, $old, $new); @@ -154,7 +145,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function cad($key, $old) { $start = microtime(true); $ret = $this->wrappedCache->cad($key, $old); @@ -166,7 +156,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function ncad(string $key, mixed $old): bool { $start = microtime(true); $ret = $this->wrappedCache->ncad($key, $old); @@ -178,7 +167,6 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL return $ret; } - /** @inheritDoc */ public function setTTL(string $key, int $ttl) { $this->wrappedCache->setTTL($key, $ttl); } diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index 711531e0ac2..6a2a62f3f7a 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -95,14 +95,6 @@ class Redis extends Cache implements IMemcacheTTL { return (is_array($keys) && (count($keys) === $deleted)); } - /** - * Set a value in the cache if it's not already stored - * - * @param string $key - * @param mixed $value - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 - * @return bool - */ public function add($key, $value, $ttl = 0) { $value = self::encodeValue($value); if ($ttl === 0) { @@ -117,37 +109,15 @@ class Redis extends Cache implements IMemcacheTTL { return $this->getCache()->set($this->getPrefix() . $key, $value, $args); } - /** - * Increase a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function inc($key, $step = 1) { return $this->getCache()->incrBy($this->getPrefix() . $key, $step); } - /** - * Decrease a stored number - * - * @param string $key - * @param int $step - * @return int | bool - */ public function dec($key, $step = 1) { $res = $this->evalLua('dec', [$key], [$step]); return ($res === 'NEX') ? false : $res; } - /** - * Compare and set - * - * @param string $key - * @param mixed $old - * @param mixed $new - * @return bool - */ public function cas($key, $old, $new) { $old = self::encodeValue($old); $new = self::encodeValue($new); @@ -155,13 +125,6 @@ class Redis extends Cache implements IMemcacheTTL { return $this->evalLua('cas', [$key], [$old, $new]) > 0; } - /** - * Compare and delete - * - * @param string $key - * @param mixed $old - * @return bool - */ public function cad($key, $old) { $old = self::encodeValue($old); diff --git a/lib/private/Migration/ConsoleOutput.php b/lib/private/Migration/ConsoleOutput.php index 7ccc4e7825a..b38aa8c8f22 100644 --- a/lib/private/Migration/ConsoleOutput.php +++ b/lib/private/Migration/ConsoleOutput.php @@ -30,23 +30,14 @@ class ConsoleOutput implements IOutput { $this->output->writeln($message, OutputInterface::VERBOSITY_VERBOSE); } - /** - * @param string $message - */ public function info($message): void { $this->output->writeln("<info>$message</info>"); } - /** - * @param string $message - */ public function warning($message): void { $this->output->writeln("<comment>$message</comment>"); } - /** - * @param int $max - */ public function startProgress($max = 0): void { if (!is_null($this->progressBar)) { $this->progressBar->finish(); @@ -55,10 +46,6 @@ class ConsoleOutput implements IOutput { $this->progressBar->start($max); } - /** - * @param int $step - * @param string $description - */ public function advance($step = 1, $description = ''): void { if (is_null($this->progressBar)) { $this->progressBar = new ProgressBar($this->output); diff --git a/lib/private/Migration/SimpleOutput.php b/lib/private/Migration/SimpleOutput.php index 31420d49932..1ba81acce0b 100644 --- a/lib/private/Migration/SimpleOutput.php +++ b/lib/private/Migration/SimpleOutput.php @@ -28,40 +28,20 @@ class SimpleOutput implements IOutput { $this->logger->debug($message, ['app' => $this->appName]); } - /** - * @param string $message - * @since 9.1.0 - */ public function info($message): void { $this->logger->info($message, ['app' => $this->appName]); } - /** - * @param string $message - * @since 9.1.0 - */ public function warning($message): void { $this->logger->warning($message, ['app' => $this->appName]); } - /** - * @param int $max - * @since 9.1.0 - */ public function startProgress($max = 0): void { } - /** - * @param int $step - * @param string $description - * @since 9.1.0 - */ public function advance($step = 1, $description = ''): void { } - /** - * @since 9.1.0 - */ public function finishProgress(): void { } } diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 5d71c83e77a..2360ccaac89 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -62,9 +62,6 @@ class NavigationManager implements INavigationManager { $this->defaultApp = null; } - /** - * @inheritDoc - */ public function add($entry) { if ($entry instanceof \Closure) { $this->closureEntries[] = $entry; @@ -101,9 +98,6 @@ class NavigationManager implements INavigationManager { $this->entries[$id] = $entry; } - /** - * @inheritDoc - */ public function getAll(string $type = 'link'): array { $this->init(); foreach ($this->closureEntries as $c) { @@ -181,16 +175,10 @@ class NavigationManager implements INavigationManager { $this->init = !$loadDefaultLinks; } - /** - * @inheritDoc - */ public function setActiveEntry($appId) { $this->activeEntry = $appId; } - /** - * @inheritDoc - */ public function getActiveEntry() { return $this->activeEntry; } diff --git a/lib/private/Notification/Action.php b/lib/private/Notification/Action.php index e2a75bea030..c3cc5b7b29f 100644 --- a/lib/private/Notification/Action.php +++ b/lib/private/Notification/Action.php @@ -18,9 +18,6 @@ class Action implements IAction { protected string $requestType = ''; protected bool $primary = false; - /** - * {@inheritDoc} - */ public function setLabel(string $label): IAction { if ($label === '' || isset($label[32])) { throw new InvalidValueException('label'); @@ -29,16 +26,10 @@ class Action implements IAction { return $this; } - /** - * {@inheritDoc} - */ public function getLabel(): string { return $this->label; } - /** - * {@inheritDoc} - */ public function setParsedLabel(string $label): IAction { if ($label === '') { throw new InvalidValueException('parsedLabel'); @@ -47,31 +38,19 @@ class Action implements IAction { return $this; } - /** - * {@inheritDoc} - */ public function getParsedLabel(): string { return $this->labelParsed; } - /** - * {@inheritDoc} - */ public function setPrimary(bool $primary): IAction { $this->primary = $primary; return $this; } - /** - * {@inheritDoc} - */ public function isPrimary(): bool { return $this->primary; } - /** - * {@inheritDoc} - */ public function setLink(string $link, string $requestType): IAction { if ($link === '' || isset($link[256])) { throw new InvalidValueException('link'); @@ -90,30 +69,18 @@ class Action implements IAction { return $this; } - /** - * {@inheritDoc} - */ public function getLink(): string { return $this->link; } - /** - * {@inheritDoc} - */ public function getRequestType(): string { return $this->requestType; } - /** - * {@inheritDoc} - */ public function isValid(): bool { return $this->label !== '' && $this->link !== ''; } - /** - * {@inheritDoc} - */ public function isValidParsed(): bool { return $this->labelParsed !== '' && $this->link !== ''; } diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index 8edbca0380d..8b8050f2876 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -66,23 +66,10 @@ class Manager implements IManager { $this->deferPushing = false; $this->parsedRegistrationContext = false; } - /** - * @param string $appClass The service must implement IApp, otherwise a - * \InvalidArgumentException is thrown later - * @since 17.0.0 - */ public function registerApp(string $appClass): void { $this->appClasses[] = $appClass; } - /** - * @param \Closure $service The service must implement INotifier, otherwise a - * \InvalidArgumentException is thrown later - * @param \Closure $info An array with the keys 'id' and 'name' containing - * the app id and the app name - * @deprecated 17.0.0 use registerNotifierService instead. - * @since 8.2.0 - Parameter $info was added in 9.0.0 - */ public function registerNotifier(\Closure $service, \Closure $info): void { $infoData = $info(); $exception = new \InvalidArgumentException( @@ -91,11 +78,6 @@ class Manager implements IManager { $this->logger->error($exception->getMessage(), ['exception' => $exception]); } - /** - * @param string $notifierService The service must implement INotifier, otherwise a - * \InvalidArgumentException is thrown later - * @since 17.0.0 - */ public function registerNotifierService(string $notifierService): void { $this->notifierClasses[] = $notifierService; } @@ -134,9 +116,6 @@ class Manager implements IManager { return $this->apps; } - /** - * @return INotifier[] - */ public function getNotifiers(): array { if (!$this->parsedRegistrationContext) { $notifierServices = $this->coordinator->getRegistrationContext()->getNotifierServices(); @@ -194,43 +173,22 @@ class Manager implements IManager { return $this->notifiers; } - /** - * @return INotification - * @since 8.2.0 - */ public function createNotification(): INotification { return new Notification($this->validator); } - /** - * @return bool - * @since 8.2.0 - */ public function hasNotifiers(): bool { return !empty($this->notifiers) || !empty($this->notifierClasses); } - /** - * @param bool $preparingPushNotification - * @since 14.0.0 - */ public function setPreparingPushNotification(bool $preparingPushNotification): void { $this->preparingPushNotification = $preparingPushNotification; } - /** - * @return bool - * @since 14.0.0 - */ public function isPreparingPushNotification(): bool { return $this->preparingPushNotification; } - /** - * The calling app should only "flush" when it got returned true on the defer call - * @return bool - * @since 20.0.0 - */ public function defer(): bool { $alreadyDeferring = $this->deferPushing; $this->deferPushing = true; @@ -246,9 +204,6 @@ class Manager implements IManager { return !$alreadyDeferring; } - /** - * @since 20.0.0 - */ public function flush(): void { $apps = $this->getApps(); @@ -266,9 +221,6 @@ class Manager implements IManager { $this->deferPushing = false; } - /** - * {@inheritDoc} - */ public function isFairUseOfFreePushService(): bool { $pushAllowed = $this->cache->get('push_fair_use'); if ($pushAllowed === null) { @@ -284,9 +236,6 @@ class Manager implements IManager { return $pushAllowed === 'yes'; } - /** - * {@inheritDoc} - */ public function notify(INotification $notification): void { if (!$notification->isValid()) { throw new IncompleteNotificationException('The given notification is invalid'); @@ -306,29 +255,14 @@ class Manager implements IManager { } } - /** - * Identifier of the notifier, only use [a-z0-9_] - * - * @return string - * @since 17.0.0 - */ public function getID(): string { return 'core'; } - /** - * Human readable name describing the notifier - * - * @return string - * @since 17.0.0 - */ public function getName(): string { return 'core'; } - /** - * {@inheritDoc} - */ public function prepare(INotification $notification, string $languageCode): INotification { $notifiers = $this->getNotifiers(); @@ -378,9 +312,6 @@ class Manager implements IManager { return $notification; } - /** - * @param INotification $notification - */ public function markProcessed(INotification $notification): void { $apps = $this->getApps(); @@ -389,10 +320,6 @@ class Manager implements IManager { } } - /** - * @param INotification $notification - * @return int - */ public function getCount(INotification $notification): int { $apps = $this->getApps(); @@ -404,9 +331,6 @@ class Manager implements IManager { return $count; } - /** - * {@inheritDoc} - */ public function dismissNotification(INotification $notification): void { $notifiers = $this->getNotifiers(); diff --git a/lib/private/Notification/Notification.php b/lib/private/Notification/Notification.php index 19c836c2044..ea2642195c9 100644 --- a/lib/private/Notification/Notification.php +++ b/lib/private/Notification/Notification.php @@ -44,9 +44,6 @@ class Notification implements INotification { $this->dateTime->setTimestamp(0); } - /** - * {@inheritDoc} - */ public function setApp(string $app): INotification { if ($app === '' || isset($app[32])) { throw new InvalidValueException('app'); @@ -55,16 +52,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getApp(): string { return $this->app; } - /** - * {@inheritDoc} - */ public function setUser(string $user): INotification { if ($user === '' || isset($user[64])) { throw new InvalidValueException('user'); @@ -73,16 +64,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getUser(): string { return $this->user; } - /** - * {@inheritDoc} - */ public function setDateTime(\DateTime $dateTime): INotification { if ($dateTime->getTimestamp() === 0) { throw new InvalidValueException('dateTime'); @@ -91,16 +76,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getDateTime(): \DateTime { return $this->dateTime; } - /** - * {@inheritDoc} - */ public function setObject(string $type, string $id): INotification { if ($type === '' || isset($type[64])) { throw new InvalidValueException('objectType'); @@ -114,23 +93,14 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getObjectType(): string { return $this->objectType; } - /** - * {@inheritDoc} - */ public function getObjectId(): string { return $this->objectId; } - /** - * {@inheritDoc} - */ public function setSubject(string $subject, array $parameters = []): INotification { if ($subject === '' || isset($subject[64])) { throw new InvalidValueException('subject'); @@ -142,23 +112,14 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getSubject(): string { return $this->subject; } - /** - * {@inheritDoc} - */ public function getSubjectParameters(): array { return $this->subjectParameters; } - /** - * {@inheritDoc} - */ public function setParsedSubject(string $subject): INotification { if ($subject === '') { throw new InvalidValueException('parsedSubject'); @@ -167,16 +128,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getParsedSubject(): string { return $this->subjectParsed; } - /** - * {@inheritDoc} - */ public function setRichSubject(string $subject, array $parameters = []): INotification { if ($subject === '') { throw new InvalidValueException('richSubject'); @@ -220,23 +175,14 @@ class Notification implements INotification { return str_replace($placeholders, $replacements, $message); } - /** - * {@inheritDoc} - */ public function getRichSubject(): string { return $this->subjectRich; } - /** - * {@inheritDoc} - */ public function getRichSubjectParameters(): array { return $this->subjectRichParameters; } - /** - * {@inheritDoc} - */ public function setMessage(string $message, array $parameters = []): INotification { if ($message === '' || isset($message[64])) { throw new InvalidValueException('message'); @@ -248,23 +194,14 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getMessage(): string { return $this->message; } - /** - * {@inheritDoc} - */ public function getMessageParameters(): array { return $this->messageParameters; } - /** - * {@inheritDoc} - */ public function setParsedMessage(string $message): INotification { if ($message === '') { throw new InvalidValueException('parsedMessage'); @@ -273,16 +210,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getParsedMessage(): string { return $this->messageParsed; } - /** - * {@inheritDoc} - */ public function setRichMessage(string $message, array $parameters = []): INotification { if ($message === '') { throw new InvalidValueException('richMessage'); @@ -302,23 +233,14 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getRichMessage(): string { return $this->messageRich; } - /** - * {@inheritDoc} - */ public function getRichMessageParameters(): array { return $this->messageRichParameters; } - /** - * {@inheritDoc} - */ public function setLink(string $link): INotification { if ($link === '' || isset($link[4000])) { throw new InvalidValueException('link'); @@ -327,16 +249,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getLink(): string { return $this->link; } - /** - * {@inheritDoc} - */ public function setIcon(string $icon): INotification { if ($icon === '' || isset($icon[4000])) { throw new InvalidValueException('icon'); @@ -345,23 +261,14 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getIcon(): string { return $this->icon; } - /** - * {@inheritDoc} - */ public function createAction(): IAction { return new Action(); } - /** - * {@inheritDoc} - */ public function addAction(IAction $action): INotification { if (!$action->isValid()) { throw new InvalidValueException('action'); @@ -379,16 +286,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getActions(): array { return $this->actions; } - /** - * {@inheritDoc} - */ public function addParsedAction(IAction $action): INotification { if (!$action->isValidParsed()) { throw new InvalidValueException('action'); @@ -410,16 +311,10 @@ class Notification implements INotification { return $this; } - /** - * {@inheritDoc} - */ public function getParsedActions(): array { return $this->actionsParsed; } - /** - * {@inheritDoc} - */ public function isValid(): bool { return $this->isValidCommon() @@ -428,9 +323,6 @@ class Notification implements INotification { ; } - /** - * {@inheritDoc} - */ public function isValidParsed(): bool { if ($this->getRichSubject() !== '' || !empty($this->getRichSubjectParameters())) { try { diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 9bda95ebc17..75dc177a590 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -33,93 +33,52 @@ class OCMProvider implements IOCMProvider { ) { } - /** - * @param bool $enabled - * - * @return $this - */ public function setEnabled(bool $enabled): static { $this->enabled = $enabled; return $this; } - /** - * @return bool - */ public function isEnabled(): bool { return $this->enabled; } - /** - * @param string $apiVersion - * - * @return $this - */ public function setApiVersion(string $apiVersion): static { $this->apiVersion = $apiVersion; return $this; } - /** - * @return string - */ public function getApiVersion(): string { return $this->apiVersion; } - /** - * @param string $endPoint - * - * @return $this - */ public function setEndPoint(string $endPoint): static { $this->endPoint = $endPoint; return $this; } - /** - * @return string - */ public function getEndPoint(): string { return $this->endPoint; } - /** - * create a new resource to later add it with {@see IOCMProvider::addResourceType()} - * @return IOCMResource - */ public function createNewResourceType(): IOCMResource { return new OCMResource(); } - /** - * @param IOCMResource $resource - * - * @return $this - */ public function addResourceType(IOCMResource $resource): static { $this->resourceTypes[] = $resource; return $this; } - /** - * @param IOCMResource[] $resourceTypes - * - * @return $this - */ public function setResourceTypes(array $resourceTypes): static { $this->resourceTypes = $resourceTypes; return $this; } - /** - * @return IOCMResource[] - */ public function getResourceTypes(): array { if (!$this->emittedEvent) { $this->emittedEvent = true; @@ -130,13 +89,6 @@ class OCMProvider implements IOCMProvider { return $this->resourceTypes; } - /** - * @param string $resourceName - * @param string $protocol - * - * @return string - * @throws OCMArgumentException - */ public function extractProtocolEntry(string $resourceName, string $protocol): string { foreach ($this->getResourceTypes() as $resource) { if ($resource->getName() === $resourceName) { @@ -152,15 +104,6 @@ class OCMProvider implements IOCMProvider { throw new OCMArgumentException('resource not found'); } - /** - * import data from an array - * - * @param array $data - * - * @return $this - * @throws OCMProviderException in case a descent provider cannot be generated from data - * @see self::jsonSerialize() - */ public function import(array $data): static { $this->setEnabled(is_bool($data['enabled'] ?? '') ? $data['enabled'] : false) ->setApiVersion((string)($data['apiVersion'] ?? '')) @@ -189,18 +132,6 @@ class OCMProvider implements IOCMProvider { } - /** - * @return array{ - * enabled: bool, - * apiVersion: string, - * endPoint: string, - * resourceTypes: array{ - * name: string, - * shareTypes: string[], - * protocols: array<string, string> - * }[] - * } - */ public function jsonSerialize(): array { $resourceTypes = []; foreach ($this->getResourceTypes() as $res) { diff --git a/lib/private/OCM/Model/OCMResource.php b/lib/private/OCM/Model/OCMResource.php index 68f9ee18f79..fc242891a94 100644 --- a/lib/private/OCM/Model/OCMResource.php +++ b/lib/private/OCM/Model/OCMResource.php @@ -21,81 +21,42 @@ class OCMResource implements IOCMResource { /** @var array<string, string> */ private array $protocols = []; - /** - * @param string $name - * - * @return $this - */ public function setName(string $name): static { $this->name = $name; return $this; } - /** - * @return string - */ public function getName(): string { return $this->name; } - /** - * @param string[] $shareTypes - * - * @return $this - */ public function setShareTypes(array $shareTypes): static { $this->shareTypes = $shareTypes; return $this; } - /** - * @return string[] - */ public function getShareTypes(): array { return $this->shareTypes; } - /** - * @param array<string, string> $protocols - * - * @return $this - */ public function setProtocols(array $protocols): static { $this->protocols = $protocols; return $this; } - /** - * @return array<string, string> - */ public function getProtocols(): array { return $this->protocols; } - /** - * import data from an array - * - * @param array $data - * - * @return $this - * @see self::jsonSerialize() - */ public function import(array $data): static { return $this->setName((string)($data['name'] ?? '')) ->setShareTypes($data['shareTypes'] ?? []) ->setProtocols($data['protocols'] ?? []); } - /** - * @return array{ - * name: string, - * shareTypes: string[], - * protocols: array<string, string> - * } - */ public function jsonSerialize(): array { return [ 'name' => $this->getName(), diff --git a/lib/private/OCM/OCMDiscoveryService.php b/lib/private/OCM/OCMDiscoveryService.php index 62313a9af80..7386ecb0a1d 100644 --- a/lib/private/OCM/OCMDiscoveryService.php +++ b/lib/private/OCM/OCMDiscoveryService.php @@ -43,13 +43,6 @@ class OCMDiscoveryService implements IOCMDiscoveryService { } - /** - * @param string $remote - * @param bool $skipCache - * - * @return IOCMProvider - * @throws OCMProviderException - */ public function discover(string $remote, bool $skipCache = false): IOCMProvider { $remote = rtrim($remote, '/'); diff --git a/lib/private/OCS/DiscoveryService.php b/lib/private/OCS/DiscoveryService.php index fc9c1bd4796..68f5dca092c 100644 --- a/lib/private/OCS/DiscoveryService.php +++ b/lib/private/OCS/DiscoveryService.php @@ -34,16 +34,6 @@ class DiscoveryService implements IDiscoveryService { } - /** - * Discover OCS end-points - * - * If no valid discovery data is found the defaults are returned - * - * @param string $remote - * @param string $service the service you want to discover - * @param bool $skipCache We won't check if the data is in the cache. This is useful if a background job is updating the status - * @return array - */ public function discover(string $remote, string $service, bool $skipCache = false): array { // Check the cache first if ($skipCache === false) { diff --git a/lib/private/PhoneNumberUtil.php b/lib/private/PhoneNumberUtil.php index e53c7a51a1b..2109d537bf6 100644 --- a/lib/private/PhoneNumberUtil.php +++ b/lib/private/PhoneNumberUtil.php @@ -16,18 +16,12 @@ use OCP\IPhoneNumberUtil; * @since 28.0.0 */ class PhoneNumberUtil implements IPhoneNumberUtil { - /** - * {@inheritDoc} - */ public function getCountryCodeForRegion(string $regionCode): ?int { $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); $countryCode = $phoneUtil->getCountryCodeForRegion($regionCode); return $countryCode === 0 ? null : $countryCode; } - /** - * {@inheritDoc} - */ public function convertToStandardFormat(string $input, ?string $defaultRegion = null): ?string { $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); try { diff --git a/lib/private/Preview/Provider.php b/lib/private/Preview/Provider.php index 26f0ac09f08..7573e4de814 100644 --- a/lib/private/Preview/Provider.php +++ b/lib/private/Preview/Provider.php @@ -21,30 +21,11 @@ abstract class Provider implements IProvider { $this->options = $options; } - /** - * @return string Regex with the mimetypes that are supported by this provider - */ abstract public function getMimeType(); - /** - * Check if a preview can be generated for $path - * - * @param \OCP\Files\FileInfo $file - * @return bool - */ public function isAvailable(\OCP\Files\FileInfo $file) { return true; } - /** - * Generates thumbnail which fits in $maxX and $maxY and keeps the aspect ratio, for file at path $path - * - * @param string $path Path of file - * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image - * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image - * @param bool $scalingup Disable/Enable upscaling of previews - * @param \OC\Files\View $fileview fileview object of user folder - * @return bool|\OCP\IImage false if no preview was generated - */ abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview); } diff --git a/lib/private/Preview/ProviderV2.php b/lib/private/Preview/ProviderV2.php index ca10aa67b36..600d67128ad 100644 --- a/lib/private/Preview/ProviderV2.php +++ b/lib/private/Preview/ProviderV2.php @@ -29,30 +29,12 @@ abstract class ProviderV2 implements IProviderV2 { $this->options = $options; } - /** - * @return string Regex with the mimetypes that are supported by this provider - */ abstract public function getMimeType(): string ; - /** - * Check if a preview can be generated for $path - * - * @param FileInfo $file - * @return bool - */ public function isAvailable(FileInfo $file): bool { return true; } - /** - * get thumbnail for file at path $path - * - * @param File $file - * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image - * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image - * @return null|\OCP\IImage false if no preview was generated - * @since 17.0.0 - */ abstract public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage; protected function useTempFile(File $file): bool { diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 6f43687ceea..3a08fa7c3ab 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -17,7 +17,6 @@ use OCP\Files\File; use OCP\Files\IAppData; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; -use OCP\Files\SimpleFS\ISimpleFile; use OCP\IBinaryFinder; use OCP\IConfig; use OCP\IPreview; @@ -77,16 +76,6 @@ class PreviewManager implements IPreview { $this->enablePreviews = $config->getSystemValueBool('enable_previews', true); } - /** - * In order to improve lazy loading a closure can be registered which will be - * called in case preview providers are actually requested - * - * $callable has to return an instance of \OCP\Preview\IProvider or \OCP\Preview\IProviderV2 - * - * @param string $mimeTypeRegex Regex with the mime types that are supported by this provider - * @param \Closure $callable - * @return void - */ public function registerProvider($mimeTypeRegex, \Closure $callable): void { if (!$this->enablePreviews) { return; @@ -99,9 +88,6 @@ class PreviewManager implements IPreview { $this->providerListDirty = true; } - /** - * Get all providers - */ public function getProviders(): array { if (!$this->enablePreviews) { return []; @@ -118,9 +104,6 @@ class PreviewManager implements IPreview { return $this->providers; } - /** - * Does the manager have any providers - */ public function hasProviders(): bool { $this->registerCoreProviders(); return !empty($this->providers); @@ -142,23 +125,6 @@ class PreviewManager implements IPreview { return $this->generator; } - /** - * Returns a preview of a file - * - * The cache is searched first and if nothing usable was found then a preview is - * generated by one of the providers - * - * @param File $file - * @param int $width - * @param int $height - * @param bool $crop - * @param string $mode - * @param string $mimeType - * @return ISimpleFile - * @throws NotFoundException - * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid) - * @since 11.0.0 - \InvalidArgumentException was added in 12.0.0 - */ public function getPreview(File $file, $width = -1, $height = -1, $crop = false, $mode = IPreview::MODE_FILL, $mimeType = null) { $this->throwIfPreviewsDisabled(); $previewConcurrency = $this->getGenerator()->getNumConcurrentPreviews('preview_concurrency_all'); @@ -172,28 +138,11 @@ class PreviewManager implements IPreview { return $preview; } - /** - * Generates previews of a file - * - * @param File $file - * @param array $specifications - * @param string $mimeType - * @return ISimpleFile the last preview that was generated - * @throws NotFoundException - * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid) - * @since 19.0.0 - */ public function generatePreviews(File $file, array $specifications, $mimeType = null) { $this->throwIfPreviewsDisabled(); return $this->getGenerator()->generatePreviews($file, $specifications, $mimeType); } - /** - * returns true if the passed mime type is supported - * - * @param string $mimeType - * @return boolean - */ public function isMimeSupported($mimeType = '*') { if (!$this->enablePreviews) { return false; @@ -216,9 +165,6 @@ class PreviewManager implements IPreview { return false; } - /** - * Check if a preview can be generated for a file - */ public function isAvailable(\OCP\Files\FileInfo $file): bool { if (!$this->enablePreviews) { return false; diff --git a/lib/private/Profile/ProfileManager.php b/lib/private/Profile/ProfileManager.php index 5e36a9c2f56..3fcdd20b9ab 100644 --- a/lib/private/Profile/ProfileManager.php +++ b/lib/private/Profile/ProfileManager.php @@ -82,9 +82,6 @@ class ProfileManager implements IProfileManager { $this->configCache = new CappedMemoryCache(); } - /** - * If no user is passed as an argument return whether profile is enabled globally in `config.php` - */ public function isProfileEnabled(?IUser $user = null): bool { $profileEnabledGlobally = $this->config->getSystemValueBool('profile.enabled', true); @@ -173,10 +170,6 @@ class ProfileManager implements IProfileManager { return $this->sortedActions; } - /** - * Return whether the profile parameter of the target user - * is visible to the visiting user - */ public function isProfileFieldVisible(string $profileField, IUser $targetUser, ?IUser $visitingUser): bool { try { $account = $this->accountManager->getAccount($targetUser); @@ -219,11 +212,6 @@ class ProfileManager implements IProfileManager { return false; } - /** - * Return the profile parameters of the target user that are visible to the visiting user - * in an associative array - * @return array{userId: string, address?: string|null, biography?: string|null, displayname?: string|null, headline?: string|null, isUserAvatarVisible?: bool, organisation?: string|null, role?: string|null, actions: list<array{id: string, icon: string, title: string, target: ?string}>} - */ public function getProfileFields(IUser $targetUser, ?IUser $visitingUser): array { $account = $this->accountManager->getAccount($targetUser); diff --git a/lib/private/Profiler/Profile.php b/lib/private/Profiler/Profile.php index c611d79e259..42e32fdc2d4 100644 --- a/lib/private/Profiler/Profile.php +++ b/lib/private/Profiler/Profile.php @@ -90,14 +90,10 @@ class Profile implements \JsonSerializable, IProfile { return $this->parent ? $this->parent->getToken() : null; } - /** @return IProfile[] */ public function getChildren(): array { return $this->children; } - /** - * @param IProfile[] $children - */ public function setChildren(array $children): void { $this->children = []; foreach ($children as $child) { @@ -110,16 +106,10 @@ class Profile implements \JsonSerializable, IProfile { $profile->setParent($this); } - /** - * @return IDataCollector[] - */ public function getCollectors(): array { return $this->collectors; } - /** - * @param IDataCollector[] $collectors - */ public function setCollectors(array $collectors): void { $this->collectors = $collectors; } diff --git a/lib/private/Profiler/Profiler.php b/lib/private/Profiler/Profiler.php index 84a4e3eff34..0a94687e689 100644 --- a/lib/private/Profiler/Profiler.php +++ b/lib/private/Profiler/Profiler.php @@ -74,9 +74,6 @@ class Profiler implements IProfiler { return $profile; } - /** - * @return array[] - */ public function find(?string $url, ?int $limit, ?string $method, ?int $start, ?int $end, ?string $statusCode = null): array { if ($this->storage) { diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php index de07eb8bc56..462d490d069 100644 --- a/lib/private/Remote/Api/OCS.php +++ b/lib/private/Remote/Api/OCS.php @@ -72,9 +72,6 @@ class OCS extends ApiBase implements ICapabilitiesApi, IUserApi { return new User($result); } - /** - * @return array The capabilities in the form of [$appId => [$capability => $value]] - */ public function getCapabilities() { $result = $this->request('get', 'cloud/capabilities'); return $result['capabilities']; diff --git a/lib/private/Remote/Credentials.php b/lib/private/Remote/Credentials.php index fb0f03ae148..2e9d2a0d46a 100644 --- a/lib/private/Remote/Credentials.php +++ b/lib/private/Remote/Credentials.php @@ -22,16 +22,10 @@ class Credentials implements ICredentials { $this->password = $password; } - /** - * @return string - */ public function getUsername() { return $this->user; } - /** - * @return string - */ public function getPassword() { return $this->password; } diff --git a/lib/private/Remote/Instance.php b/lib/private/Remote/Instance.php index ac3233b93c9..13619cd1690 100644 --- a/lib/private/Remote/Instance.php +++ b/lib/private/Remote/Instance.php @@ -38,41 +38,24 @@ class Instance implements IInstance { $this->clientService = $clientService; } - /** - * @return string The url of the remote server without protocol - */ public function getUrl() { return $this->url; } - /** - * @return string The of the remote server with protocol - */ public function getFullUrl() { return $this->getProtocol() . '://' . $this->getUrl(); } - /** - * @return string The full version string in '13.1.2.3' format - */ public function getVersion() { $status = $this->getStatus(); return $status['version']; } - /** - * @return string 'http' or 'https' - */ public function getProtocol() { $status = $this->getStatus(); return $status['protocol']; } - /** - * Check that the remote server is installed and not in maintenance mode - * - * @return bool - */ public function isActive() { $status = $this->getStatus(); return $status['installed'] && !$status['maintenance']; diff --git a/lib/private/Remote/User.php b/lib/private/Remote/User.php index 5c8e9d3ca4e..e90675af31c 100644 --- a/lib/private/Remote/User.php +++ b/lib/private/Remote/User.php @@ -28,93 +28,54 @@ class User implements IUser { } - /** - * @return string - */ public function getUserId() { return $this->data['id']; } - /** - * @return string - */ public function getEmail() { return $this->data['email']; } - /** - * @return string - */ public function getDisplayName() { return $this->data['displayname']; } - /** - * @return string - */ public function getPhone() { return $this->data['phone']; } - /** - * @return string - */ public function getAddress() { return $this->data['address']; } - /** - * @return string - */ public function getWebsite() { return $this->data['website']; } - /** - * @return string - */ public function getTwitter() { return $this->data['twitter'] ?? ''; } - /** - * @return string[] - */ public function getGroups() { return $this->data['groups']; } - /** - * @return string - */ public function getLanguage() { return $this->data['language']; } - /** - * @return int - */ public function getUsedSpace() { return $this->data['quota']['used']; } - /** - * @return int - */ public function getFreeSpace() { return $this->data['quota']['free']; } - /** - * @return int - */ public function getTotalSpace() { return $this->data['quota']['total']; } - /** - * @return int - */ public function getQuota() { return $this->data['quota']['quota']; } diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 630ee249209..138e63be330 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -229,42 +229,26 @@ class Repair implements IOutput { public function debug(string $message): void { } - /** - * @param string $message - */ public function info($message) { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairInfoEvent($message)); } - /** - * @param string $message - */ public function warning($message) { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairWarningEvent($message)); } - /** - * @param int $max - */ public function startProgress($max = 0) { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairStartEvent($max, $this->currentStep)); } - /** - * @param int $step number of step to advance - * @param string $description - */ public function advance($step = 1, $description = '') { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairAdvanceEvent($step, $description)); } - /** - * @param int $max - */ public function finishProgress() { // for now just emit as we did in the past $this->dispatcher->dispatchTyped(new RepairFinishEvent()); diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php index 258808cb28a..7275b709eac 100644 --- a/lib/private/Repair/CleanTags.php +++ b/lib/private/Repair/CleanTags.php @@ -36,16 +36,10 @@ class CleanTags implements IRepairStep { $this->userManager = $userManager; } - /** - * @return string - */ public function getName() { return 'Clean tags and favorites'; } - /** - * Updates the configuration after running an update - */ public function run(IOutput $output) { $this->deleteOrphanTags($output); $this->deleteOrphanFileEntries($output); diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index 9557aabd718..19e75b95b70 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -45,9 +45,6 @@ class Collation implements IRepairStep { return 'Repair MySQL collation'; } - /** - * Fix mime types - */ public function run(IOutput $output) { if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { $output->info('Not a mysql database -> nothing to do'); diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php index 027f179596c..015e1f6c523 100644 --- a/lib/private/Repair/OldGroupMembershipShares.php +++ b/lib/private/Repair/OldGroupMembershipShares.php @@ -34,21 +34,10 @@ class OldGroupMembershipShares implements IRepairStep { $this->groupManager = $groupManager; } - /** - * Returns the step's name - * - * @return string - */ public function getName() { return 'Remove shares of old group memberships'; } - /** - * Run repair step. - * Must throw exception on error. - * - * @throws \Exception in case of failure - */ public function run(IOutput $output) { $deletedEntries = 0; diff --git a/lib/private/Repair/Owncloud/CleanPreviews.php b/lib/private/Repair/Owncloud/CleanPreviews.php index 86e173cf402..798d8860d58 100644 --- a/lib/private/Repair/Owncloud/CleanPreviews.php +++ b/lib/private/Repair/Owncloud/CleanPreviews.php @@ -37,9 +37,6 @@ class CleanPreviews implements IRepairStep { $this->config = $config; } - /** - * @return string - */ public function getName() { return 'Add preview cleanup background jobs'; } diff --git a/lib/private/Repair/Owncloud/DropAccountTermsTable.php b/lib/private/Repair/Owncloud/DropAccountTermsTable.php index 18f169c9b49..fdf24b02cc4 100644 --- a/lib/private/Repair/Owncloud/DropAccountTermsTable.php +++ b/lib/private/Repair/Owncloud/DropAccountTermsTable.php @@ -20,16 +20,10 @@ class DropAccountTermsTable implements IRepairStep { $this->db = $db; } - /** - * @return string - */ public function getName() { return 'Drop account terms table when migrating from ownCloud'; } - /** - * @param IOutput $output - */ public function run(IOutput $output) { if (!$this->db->tableExists('account_terms')) { return; diff --git a/lib/private/Repair/Owncloud/MigrateOauthTables.php b/lib/private/Repair/Owncloud/MigrateOauthTables.php index 94ec0eba3e6..5ed3ef53e73 100644 --- a/lib/private/Repair/Owncloud/MigrateOauthTables.php +++ b/lib/private/Repair/Owncloud/MigrateOauthTables.php @@ -22,9 +22,6 @@ class MigrateOauthTables implements IRepairStep { $this->db = $db; } - /** - * @return string - */ public function getName() { return 'Migrate oauth2_clients table to nextcloud schema'; } diff --git a/lib/private/Repair/Owncloud/MoveAvatars.php b/lib/private/Repair/Owncloud/MoveAvatars.php index 7fdabae7a66..14c364ce6de 100644 --- a/lib/private/Repair/Owncloud/MoveAvatars.php +++ b/lib/private/Repair/Owncloud/MoveAvatars.php @@ -29,9 +29,6 @@ class MoveAvatars implements IRepairStep { $this->config = $config; } - /** - * @return string - */ public function getName() { return 'Add move avatar background job'; } diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 08665687b29..71458d13cda 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -36,16 +36,10 @@ class SaveAccountsTableData implements IRepairStep { $this->config = $config; } - /** - * @return string - */ public function getName() { return 'Copy data from accounts table when migrating from ownCloud'; } - /** - * @param IOutput $output - */ public function run(IOutput $output) { if (!$this->shouldRun()) { return; diff --git a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php index e27ab06b2f3..9d0c9f0eb9e 100644 --- a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php +++ b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php @@ -28,16 +28,10 @@ class UpdateLanguageCodes implements IRepairStep { $this->config = $config; } - /** - * {@inheritdoc} - */ public function getName() { return 'Repair language codes'; } - /** - * {@inheritdoc} - */ public function run(IOutput $output) { $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); diff --git a/lib/private/Repair/RepairDavShares.php b/lib/private/Repair/RepairDavShares.php index 792fdd4033e..ad3ea48a42a 100644 --- a/lib/private/Repair/RepairDavShares.php +++ b/lib/private/Repair/RepairDavShares.php @@ -46,9 +46,6 @@ class RepairDavShares implements IRepairStep { $this->logger = $logger; } - /** - * @inheritDoc - */ public function getName() { return 'Repair DAV shares'; } @@ -104,9 +101,6 @@ class RepairDavShares implements IRepairStep { return true; } - /** - * @inheritDoc - */ public function run(IOutput $output) { $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); if (version_compare($versionFromBeforeUpdate, '20.0.8', '<') diff --git a/lib/private/Repair/RepairMimeTypes.php b/lib/private/Repair/RepairMimeTypes.php index 6932299dc4a..cbf255c11a6 100644 --- a/lib/private/Repair/RepairMimeTypes.php +++ b/lib/private/Repair/RepairMimeTypes.php @@ -324,11 +324,6 @@ class RepairMimeTypes implements IRepairStep { return $serverVersion; } - /** - * Fix mime types - * - * @throws Exception - */ public function run(IOutput $out): void { $serverVersion = $this->config->getSystemValueString('version', '0.0.0'); $mimeTypeVersion = $this->getMimeTypeVersion(); diff --git a/lib/private/RichObjectStrings/Validator.php b/lib/private/RichObjectStrings/Validator.php index 41c2456ba27..0a9afff24d7 100644 --- a/lib/private/RichObjectStrings/Validator.php +++ b/lib/private/RichObjectStrings/Validator.php @@ -31,12 +31,6 @@ class Validator implements IValidator { $this->definitions = $definitions; } - /** - * @param string $subject - * @param array[] $parameters - * @throws InvalidObjectExeption - * @since 11.0.0 - */ public function validate($subject, array $parameters) { $matches = []; $result = preg_match_all('/\{([a-z0-9]+)\}/i', $subject, $matches); diff --git a/lib/private/Route/Route.php b/lib/private/Route/Route.php index ab5a1f6b59a..3489edfce8b 100644 --- a/lib/private/Route/Route.php +++ b/lib/private/Route/Route.php @@ -11,68 +11,36 @@ use OCP\Route\IRoute; use Symfony\Component\Routing\Route as SymfonyRoute; class Route extends SymfonyRoute implements IRoute { - /** - * Specify the method when this route is to be used - * - * @param string $method HTTP method (uppercase) - * @return \OC\Route\Route - */ public function method($method) { $this->setMethods($method); return $this; } - /** - * Specify POST as the method to use with this route - * @return \OC\Route\Route - */ public function post() { $this->method('POST'); return $this; } - /** - * Specify GET as the method to use with this route - * @return \OC\Route\Route - */ public function get() { $this->method('GET'); return $this; } - /** - * Specify PUT as the method to use with this route - * @return \OC\Route\Route - */ public function put() { $this->method('PUT'); return $this; } - /** - * Specify DELETE as the method to use with this route - * @return \OC\Route\Route - */ public function delete() { $this->method('DELETE'); return $this; } - /** - * Specify PATCH as the method to use with this route - * @return \OC\Route\Route - */ public function patch() { $this->method('PATCH'); return $this; } - /** - * Defaults to use for this route - * - * @param array $defaults The defaults - * @return \OC\Route\Route - */ public function defaults($defaults) { $action = $this->getDefault('action'); $this->setDefaults($defaults); @@ -83,12 +51,6 @@ class Route extends SymfonyRoute implements IRoute { return $this; } - /** - * Requirements for this route - * - * @param array $requirements The requirements - * @return \OC\Route\Route - */ public function requirements($requirements) { $method = $this->getMethods(); $this->setRequirements($requirements); @@ -101,16 +63,6 @@ class Route extends SymfonyRoute implements IRoute { return $this; } - /** - * The action to execute when this route matches - * - * @param string|callable $class the class or a callable - * @param string $function the function to use with the class - * @return \OC\Route\Route - * - * This function is called with $class set to a callable or - * to the class with $function - */ public function action($class, $function = null) { $action = [$class, $function]; if (is_null($function)) { @@ -120,12 +72,6 @@ class Route extends SymfonyRoute implements IRoute { return $this; } - /** - * The action to execute when this route matches, includes a file like - * it is called directly - * @param string $file - * @return void - */ public function actionInclude($file) { $function = function ($param) use ($file) { unset($param['_route']); diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 646d1d4e6ed..69d3b94e50d 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -207,15 +207,6 @@ class Router implements IRouter { } - /** - * Create a \OC\Route\Route. - * - * @param string $name Name of the route to create. - * @param string $pattern The pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @return \OC\Route\Route - */ public function create($name, $pattern, array $defaults = [], diff --git a/lib/private/Search/Filter/StringsFilter.php b/lib/private/Search/Filter/StringsFilter.php index 8b8fabb5347..22be8c5ac6d 100644 --- a/lib/private/Search/Filter/StringsFilter.php +++ b/lib/private/Search/Filter/StringsFilter.php @@ -25,9 +25,6 @@ class StringsFilter implements IFilter { } } - /** - * @return string[] - */ public function get(): array { return $this->values; } diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 596fcf408fa..189fd204c67 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -43,9 +43,6 @@ class Throttler implements IThrottler { ) { } - /** - * {@inheritDoc} - */ public function registerAttempt(string $action, string $ip, array $metadata = []): void { @@ -79,9 +76,6 @@ class Throttler implements IThrottler { ); } - /** - * Check if the IP is whitelisted - */ public function isBypassListed(string $ip): bool { if (isset($this->ipIsWhitelisted[$ip])) { return $this->ipIsWhitelisted[$ip]; @@ -149,18 +143,12 @@ class Throttler implements IThrottler { return false; } - /** - * {@inheritDoc} - */ public function showBruteforceWarning(string $ip, string $action = ''): bool { $attempts = $this->getAttempts($ip, $action); // 4 failed attempts is the last delay below 5 seconds return $attempts >= 4; } - /** - * {@inheritDoc} - */ public function getAttempts(string $ip, string $action = '', float $maxAgeHours = 12): int { if ($maxAgeHours > 48) { $this->logger->error('Bruteforce has to use less than 48 hours'); @@ -185,9 +173,6 @@ class Throttler implements IThrottler { ); } - /** - * {@inheritDoc} - */ public function getDelay(string $ip, string $action = ''): int { $attempts = $this->getAttempts($ip, $action); if ($attempts === 0) { @@ -207,9 +192,6 @@ class Throttler implements IThrottler { return (int)\ceil($delay * 1000); } - /** - * {@inheritDoc} - */ public function resetDelay(string $ip, string $action, array $metadata): void { // No need to log if the bruteforce protection is disabled if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) { @@ -230,9 +212,6 @@ class Throttler implements IThrottler { $this->hasAttemptsDeleted[$action] = true; } - /** - * {@inheritDoc} - */ public function resetDelayForIP(string $ip): void { // No need to log if the bruteforce protection is disabled if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) { @@ -247,9 +226,6 @@ class Throttler implements IThrottler { $this->backend->resetAttempts($ipAddress->getSubnet()); } - /** - * {@inheritDoc} - */ public function sleepDelay(string $ip, string $action = ''): int { $delay = $this->getDelay($ip, $action); if (!$this->config->getSystemValueBool('auth.bruteforce.protection.testing')) { @@ -258,9 +234,6 @@ class Throttler implements IThrottler { return $delay; } - /** - * {@inheritDoc} - */ public function sleepDelayOrThrowOnMax(string $ip, string $action = ''): int { $delay = $this->getDelay($ip, $action); if (($delay === self::MAX_DELAY_MS) && $this->getAttempts($ip, $action, 0.5) > self::MAX_ATTEMPTS) { diff --git a/lib/private/Security/CSP/ContentSecurityPolicyManager.php b/lib/private/Security/CSP/ContentSecurityPolicyManager.php index 77ecceb03c3..0178da1c58a 100644 --- a/lib/private/Security/CSP/ContentSecurityPolicyManager.php +++ b/lib/private/Security/CSP/ContentSecurityPolicyManager.php @@ -24,7 +24,6 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager { ) { } - /** {@inheritdoc} */ public function addDefaultPolicy(EmptyContentSecurityPolicy $policy): void { $this->policies[] = $policy; } diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php index 00babff735f..b8de32b4693 100644 --- a/lib/private/Security/CertificateManager.php +++ b/lib/private/Security/CertificateManager.php @@ -29,11 +29,6 @@ class CertificateManager implements ICertificateManager { ) { } - /** - * Returns all certificates trusted by the user - * - * @return \OCP\ICertificate[] - */ public function listCertificates(): array { if (!$this->config->getSystemValueBool('installed', false)) { return []; @@ -141,13 +136,6 @@ class CertificateManager implements ICertificateManager { $this->view->rename($tmpPath, $certPath); } - /** - * Save the certificate and re-generate the certificate bundle - * - * @param string $certificate the certificate data - * @param string $name the filename for the certificate - * @throws \Exception If the certificate could not get added - */ public function addCertificate(string $certificate, string $name): ICertificate { $path = $this->getPathToCertificates() . 'uploads/' . $name; $directory = dirname($path); @@ -169,9 +157,6 @@ class CertificateManager implements ICertificateManager { } } - /** - * Remove the certificate and re-generate the certificate bundle - */ public function removeCertificate(string $name): bool { $path = $this->getPathToCertificates() . 'uploads/' . $name; @@ -189,17 +174,10 @@ class CertificateManager implements ICertificateManager { return true; } - /** - * Get the path to the certificate bundle - */ public function getCertificateBundle(): string { return $this->getPathToCertificates() . 'rootcerts.crt'; } - /** - * Get the full local path to the certificate bundle - * @throws \Exception when getting bundle path fails - */ public function getAbsoluteBundlePath(): string { try { if ($this->bundlePath === null) { diff --git a/lib/private/Security/CredentialsManager.php b/lib/private/Security/CredentialsManager.php index fdf2c46ecf8..7de328f4f50 100644 --- a/lib/private/Security/CredentialsManager.php +++ b/lib/private/Security/CredentialsManager.php @@ -26,12 +26,6 @@ class CredentialsManager implements ICredentialsManager { ) { } - /** - * Store a set of credentials - * - * @param string $userId empty string for system-wide credentials - * @param mixed $credentials - */ public function store(string $userId, string $identifier, $credentials): void { $value = $this->crypto->encrypt(json_encode($credentials)); @@ -43,11 +37,6 @@ class CredentialsManager implements ICredentialsManager { ]); } - /** - * Retrieve a set of credentials - * - * @param string $userId empty string for system-wide credentials - */ public function retrieve(string $userId, string $identifier): mixed { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('credentials') @@ -72,12 +61,6 @@ class CredentialsManager implements ICredentialsManager { return json_decode($this->crypto->decrypt($value), true); } - /** - * Delete a set of credentials - * - * @param string $userId empty string for system-wide credentials - * @return int rows removed - */ public function delete(string $userId, string $identifier): int { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete(self::DB_TABLE) @@ -92,11 +75,6 @@ class CredentialsManager implements ICredentialsManager { return $qb->execute(); } - /** - * Erase all credentials stored for a user - * - * @return int rows removed - */ public function erase(string $userId): int { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete(self::DB_TABLE) diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php index b03f8a4ddce..6fce44af51d 100644 --- a/lib/private/Security/Crypto.php +++ b/lib/private/Security/Crypto.php @@ -34,11 +34,6 @@ class Crypto implements ICrypto { $this->cipher = new AES(); } - /** - * @param string $message The message to authenticate - * @param string $password Password to use (defaults to `secret` in config.php) - * @return string Calculated HMAC - */ public function calculateHMAC(string $message, string $password = ''): string { if ($password === '') { $password = $this->config->getSystemValueString('secret'); @@ -52,14 +47,6 @@ class Crypto implements ICrypto { return $hash->hash($message); } - /** - * Encrypts a value and adds an HMAC (Encrypt-Then-MAC) - * - * @param string $password Password to encrypt, if not specified the secret from config.php will be taken - * @return string Authenticated ciphertext - * @throws Exception if it was not possible to gather sufficient entropy - * @throws Exception if encrypting the data failed - */ public function encrypt(string $plaintext, string $password = ''): string { if ($password === '') { $password = $this->config->getSystemValueString('secret'); @@ -83,12 +70,6 @@ class Crypto implements ICrypto { return $ciphertext.'|'.$iv.'|'.$hmac.'|3'; } - /** - * Decrypts a value and verifies the HMAC (Encrypt-Then-Mac) - * @param string $password Password to encrypt, if not specified the secret from config.php will be taken - * @throws Exception If the HMAC does not match - * @throws Exception If the decryption failed - */ public function decrypt(string $authenticatedCiphertext, string $password = ''): string { $secret = $this->config->getSystemValue('secret'); try { diff --git a/lib/private/Security/Hasher.php b/lib/private/Security/Hasher.php index 3ab0e1bbcac..461b226b672 100644 --- a/lib/private/Security/Hasher.php +++ b/lib/private/Security/Hasher.php @@ -54,14 +54,6 @@ class Hasher implements IHasher { } } - /** - * Hashes a message using PHP's `password_hash` functionality. - * Please note that the size of the returned string is not guaranteed - * and can be up to 255 characters. - * - * @param string $message Message to generate hash from - * @return string Hash of the message with appended version parameter - */ public function hash(string $message): string { $alg = $this->getPrefferedAlgorithm(); @@ -144,12 +136,6 @@ class Hasher implements IHasher { return false; } - /** - * @param string $message Message to verify - * @param string $hash Assumed hash of the message - * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one. - * @return bool Whether $hash is a valid hash of $message - */ public function verify(string $message, string $hash, &$newHash = null): bool { $splittedHash = $this->splitHash($hash); diff --git a/lib/private/Security/RateLimiting/Limiter.php b/lib/private/Security/RateLimiting/Limiter.php index b7ac26d9132..953c2bbc85d 100644 --- a/lib/private/Security/RateLimiting/Limiter.php +++ b/lib/private/Security/RateLimiting/Limiter.php @@ -38,12 +38,6 @@ class Limiter implements ILimiter { $this->backend->registerAttempt($methodIdentifier, $userIdentifier, $period); } - /** - * Registers attempt for an anonymous request - * - * @param int $anonPeriod in seconds - * @throws RateLimitExceededException - */ public function registerAnonRequest( string $identifier, int $anonLimit, @@ -56,12 +50,6 @@ class Limiter implements ILimiter { $this->register($identifier, $anonHashIdentifier, $anonPeriod, $anonLimit); } - /** - * Registers attempt for an authenticated request - * - * @param int $userPeriod in seconds - * @throws RateLimitExceededException - */ public function registerUserRequest( string $identifier, int $userLimit, diff --git a/lib/private/Security/SecureRandom.php b/lib/private/Security/SecureRandom.php index b2a3d19ce74..8290d50413b 100644 --- a/lib/private/Security/SecureRandom.php +++ b/lib/private/Security/SecureRandom.php @@ -20,13 +20,6 @@ use OCP\Security\ISecureRandom; * @package OC\Security */ class SecureRandom implements ISecureRandom { - /** - * Generate a secure random string of specified length. - * @param int $length The length of the generated string - * @param string $characters An optional list of characters to use if no character list is - * specified all valid base64 characters are used. - * @throws \LengthException if an invalid length is requested - */ public function generate( int $length, string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', diff --git a/lib/private/Security/TrustedDomainHelper.php b/lib/private/Security/TrustedDomainHelper.php index a65779780e8..c3299ae95a3 100644 --- a/lib/private/Security/TrustedDomainHelper.php +++ b/lib/private/Security/TrustedDomainHelper.php @@ -33,9 +33,6 @@ class TrustedDomainHelper implements ITrustedDomainHelper { return $host; } - /** - * {@inheritDoc} - */ public function isTrustedUrl(string $url): bool { $parsedUrl = parse_url($url); if (empty($parsedUrl['host'])) { @@ -49,9 +46,6 @@ class TrustedDomainHelper implements ITrustedDomainHelper { return $this->isTrustedDomain($parsedUrl['host']); } - /** - * {@inheritDoc} - */ public function isTrustedDomain(string $domainWithPort): bool { // overwritehost is always trusted if ($this->config->getSystemValue('overwritehost') !== '') { diff --git a/lib/private/Server.php b/lib/private/Server.php index 01d5bdac0b6..9605f5e151a 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -178,7 +178,6 @@ use OCP\IDBConnection; use OCP\IEventSourceFactory; use OCP\IGroupManager; use OCP\IInitialStateService; -use OCP\IL10N; use OCP\ILogger; use OCP\INavigationManager; use OCP\IPhoneNumberUtil; @@ -209,7 +208,6 @@ use OCP\Remote\IInstanceFactory; use OCP\RichObjectStrings\IValidator; use OCP\Route\IRouter; use OCP\Security\Bruteforce\IThrottler; -use OCP\Security\IContentSecurityPolicyManager; use OCP\Security\ICredentialsManager; use OCP\Security\ICrypto; use OCP\Security\IHasher; @@ -1424,26 +1422,14 @@ class Server extends ServerContainer implements IServerContainer { $hookConnector->viewToNode(); } - /** - * @return \OCP\Calendar\IManager - * @deprecated 20.0.0 - */ public function getCalendarManager() { return $this->get(\OC\Calendar\Manager::class); } - /** - * @return \OCP\Calendar\Resource\IManager - * @deprecated 20.0.0 - */ public function getCalendarResourceBackendManager() { return $this->get(\OC\Calendar\Resource\Manager::class); } - /** - * @return \OCP\Calendar\Room\IManager - * @deprecated 20.0.0 - */ public function getCalendarRoomBackendManager() { return $this->get(\OC\Calendar\Room\Manager::class); } @@ -1460,111 +1446,46 @@ class Server extends ServerContainer implements IServerContainer { GenerateBlurhashMetadata::loadListeners($eventDispatcher); } - /** - * @return \OCP\Contacts\IManager - * @deprecated 20.0.0 - */ public function getContactsManager() { return $this->get(\OCP\Contacts\IManager::class); } - /** - * @return \OC\Encryption\Manager - * @deprecated 20.0.0 - */ public function getEncryptionManager() { return $this->get(\OCP\Encryption\IManager::class); } - /** - * @return \OC\Encryption\File - * @deprecated 20.0.0 - */ public function getEncryptionFilesHelper() { return $this->get(IFile::class); } - /** - * @return \OCP\Encryption\Keys\IStorage - * @deprecated 20.0.0 - */ public function getEncryptionKeyStorage() { return $this->get(IStorage::class); } - /** - * The current request object holding all information about the request - * currently being processed is returned from this method. - * In case the current execution was not initiated by a web request null is returned - * - * @return \OCP\IRequest - * @deprecated 20.0.0 - */ public function getRequest() { return $this->get(IRequest::class); } - /** - * Returns the preview manager which can create preview images for a given file - * - * @return IPreview - * @deprecated 20.0.0 - */ public function getPreviewManager() { return $this->get(IPreview::class); } - /** - * Returns the tag manager which can get and set tags for different object types - * - * @see \OCP\ITagManager::load() - * @return ITagManager - * @deprecated 20.0.0 - */ public function getTagManager() { return $this->get(ITagManager::class); } - /** - * Returns the system-tag manager - * - * @return ISystemTagManager - * - * @since 9.0.0 - * @deprecated 20.0.0 - */ public function getSystemTagManager() { return $this->get(ISystemTagManager::class); } - /** - * Returns the system-tag object mapper - * - * @return ISystemTagObjectMapper - * - * @since 9.0.0 - * @deprecated 20.0.0 - */ public function getSystemTagObjectMapper() { return $this->get(ISystemTagObjectMapper::class); } - /** - * Returns the avatar manager, used for avatar functionality - * - * @return IAvatarManager - * @deprecated 20.0.0 - */ public function getAvatarManager() { return $this->get(IAvatarManager::class); } - /** - * Returns the root folder of ownCloud's data directory - * - * @return IRootFolder - * @deprecated 20.0.0 - */ public function getRootFolder() { return $this->get(IRootFolder::class); } @@ -1581,13 +1502,6 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(IRootFolder::class); } - /** - * Returns a view to ownCloud's files folder - * - * @param string $userId user ID - * @return \OCP\Files\Folder|null - * @deprecated 20.0.0 - */ public function getUserFolder($userId = null) { if ($userId === null) { $user = $this->get(IUserSession::class)->getUser(); @@ -1600,34 +1514,18 @@ class Server extends ServerContainer implements IServerContainer { return $root->getUserFolder($userId); } - /** - * @return \OC\User\Manager - * @deprecated 20.0.0 - */ public function getUserManager() { return $this->get(IUserManager::class); } - /** - * @return \OC\Group\Manager - * @deprecated 20.0.0 - */ public function getGroupManager() { return $this->get(IGroupManager::class); } - /** - * @return \OC\User\Session - * @deprecated 20.0.0 - */ public function getUserSession() { return $this->get(IUserSession::class); } - /** - * @return \OCP\ISession - * @deprecated 20.0.0 - */ public function getSession() { return $this->get(Session::class)->getSession(); } @@ -1650,18 +1548,10 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(\OC\Authentication\TwoFactorAuth\Manager::class); } - /** - * @return \OC\NavigationManager - * @deprecated 20.0.0 - */ public function getNavigationManager() { return $this->get(INavigationManager::class); } - /** - * @return \OCP\IConfig - * @deprecated 20.0.0 - */ public function getConfig() { return $this->get(AllConfig::class); } @@ -1674,40 +1564,18 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(SystemConfig::class); } - /** - * Returns the app config manager - * - * @return IAppConfig - * @deprecated 20.0.0 - */ public function getAppConfig() { return $this->get(IAppConfig::class); } - /** - * @return IFactory - * @deprecated 20.0.0 - */ public function getL10NFactory() { return $this->get(IFactory::class); } - /** - * get an L10N instance - * - * @param string $app appid - * @param string $lang - * @return IL10N - * @deprecated 20.0.0 use DI of {@see IL10N} or {@see IFactory} instead, or {@see \OCP\Util::getL10N()} as a last resort - */ public function getL10N($app, $lang = null) { return $this->get(IFactory::class)->get($app, $lang); } - /** - * @return IURLGenerator - * @deprecated 20.0.0 - */ public function getURLGenerator() { return $this->get(IURLGenerator::class); } @@ -1720,23 +1588,10 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(AppFetcher::class); } - /** - * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use - * getMemCacheFactory() instead. - * - * @return ICache - * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache - */ public function getCache() { return $this->get(ICache::class); } - /** - * Returns an \OCP\CacheFactory instance - * - * @return \OCP\ICacheFactory - * @deprecated 20.0.0 - */ public function getMemCacheFactory() { return $this->get(ICacheFactory::class); } @@ -1752,184 +1607,74 @@ class Server extends ServerContainer implements IServerContainer { } - /** - * Returns the current session - * - * @return \OCP\IDBConnection - * @deprecated 20.0.0 - */ public function getDatabaseConnection() { return $this->get(IDBConnection::class); } - /** - * Returns the activity manager - * - * @return \OCP\Activity\IManager - * @deprecated 20.0.0 - */ public function getActivityManager() { return $this->get(\OCP\Activity\IManager::class); } - /** - * Returns an job list for controlling background jobs - * - * @return IJobList - * @deprecated 20.0.0 - */ public function getJobList() { return $this->get(IJobList::class); } - /** - * Returns a logger instance - * - * @return ILogger - * @deprecated 20.0.0 - */ public function getLogger() { return $this->get(ILogger::class); } - /** - * @return ILogFactory - * @throws \OCP\AppFramework\QueryException - * @deprecated 20.0.0 - */ public function getLogFactory() { return $this->get(ILogFactory::class); } - /** - * Returns a router for generating and matching urls - * - * @return IRouter - * @deprecated 20.0.0 - */ public function getRouter() { return $this->get(IRouter::class); } - /** - * Returns a SecureRandom instance - * - * @return \OCP\Security\ISecureRandom - * @deprecated 20.0.0 - */ public function getSecureRandom() { return $this->get(ISecureRandom::class); } - /** - * Returns a Crypto instance - * - * @return ICrypto - * @deprecated 20.0.0 - */ public function getCrypto() { return $this->get(ICrypto::class); } - /** - * Returns a Hasher instance - * - * @return IHasher - * @deprecated 20.0.0 - */ public function getHasher() { return $this->get(IHasher::class); } - /** - * Returns a CredentialsManager instance - * - * @return ICredentialsManager - * @deprecated 20.0.0 - */ public function getCredentialsManager() { return $this->get(ICredentialsManager::class); } - /** - * Get the certificate manager - * - * @return \OCP\ICertificateManager - */ public function getCertificateManager() { return $this->get(ICertificateManager::class); } - /** - * Returns an instance of the HTTP client service - * - * @return IClientService - * @deprecated 20.0.0 - */ public function getHTTPClientService() { return $this->get(IClientService::class); } - /** - * Get the active event logger - * - * The returned logger only logs data when debug mode is enabled - * - * @return IEventLogger - * @deprecated 20.0.0 - */ public function getEventLogger() { return $this->get(IEventLogger::class); } - /** - * Get the active query logger - * - * The returned logger only logs data when debug mode is enabled - * - * @return IQueryLogger - * @deprecated 20.0.0 - */ public function getQueryLogger() { return $this->get(IQueryLogger::class); } - /** - * Get the manager for temporary files and folders - * - * @return \OCP\ITempManager - * @deprecated 20.0.0 - */ public function getTempManager() { return $this->get(ITempManager::class); } - /** - * Get the app manager - * - * @return \OCP\App\IAppManager - * @deprecated 20.0.0 - */ public function getAppManager() { return $this->get(IAppManager::class); } - /** - * Creates a new mailer - * - * @return IMailer - * @deprecated 20.0.0 - */ public function getMailer() { return $this->get(IMailer::class); } - /** - * Get the webroot - * - * @return string - * @deprecated 20.0.0 - */ public function getWebRoot() { return $this->webRoot; } @@ -1942,44 +1687,22 @@ class Server extends ServerContainer implements IServerContainer { return $this->get('OcsClient'); } - /** - * @return IDateTimeZone - * @deprecated 20.0.0 - */ public function getDateTimeZone() { return $this->get(IDateTimeZone::class); } - /** - * @return IDateTimeFormatter - * @deprecated 20.0.0 - */ public function getDateTimeFormatter() { return $this->get(IDateTimeFormatter::class); } - /** - * @return IMountProviderCollection - * @deprecated 20.0.0 - */ public function getMountProviderCollection() { return $this->get(IMountProviderCollection::class); } - /** - * Get the IniWrapper - * - * @return IniGetWrapper - * @deprecated 20.0.0 - */ public function getIniWrapper() { return $this->get(IniGetWrapper::class); } - /** - * @return \OCP\Command\IBus - * @deprecated 20.0.0 - */ public function getCommandBus() { return $this->get(IBus::class); } @@ -1994,21 +1717,10 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(TrustedDomainHelper::class); } - /** - * Get the locking provider - * - * @return ILockingProvider - * @since 8.1.0 - * @deprecated 20.0.0 - */ public function getLockingProvider() { return $this->get(ILockingProvider::class); } - /** - * @return IMountManager - * @deprecated 20.0.0 - **/ public function getMountManager() { return $this->get(IMountManager::class); } @@ -2021,22 +1733,10 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(IUserMountCache::class); } - /** - * Get the MimeTypeDetector - * - * @return IMimeTypeDetector - * @deprecated 20.0.0 - */ public function getMimeTypeDetector() { return $this->get(IMimeTypeDetector::class); } - /** - * Get the MimeTypeLoader - * - * @return IMimeTypeLoader - * @deprecated 20.0.0 - */ public function getMimeTypeLoader() { return $this->get(IMimeTypeLoader::class); } @@ -2051,21 +1751,10 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(CapabilitiesManager::class); } - /** - * Get the Notification Manager - * - * @return \OCP\Notification\IManager - * @since 8.2.0 - * @deprecated 20.0.0 - */ public function getNotificationManager() { return $this->get(\OCP\Notification\IManager::class); } - /** - * @return ICommentsManager - * @deprecated 20.0.0 - */ public function getCommentsManager() { return $this->get(ICommentsManager::class); } @@ -2110,10 +1799,6 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(Throttler::class); } - /** - * @return IContentSecurityPolicyManager - * @deprecated 20.0.0 - */ public function getContentSecurityPolicyManager() { return $this->get(ContentSecurityPolicyManager::class); } @@ -2166,10 +1851,6 @@ class Server extends ServerContainer implements IServerContainer { return $this->get(UserStoragesService::class); } - /** - * @return \OCP\Share\IManager - * @deprecated 20.0.0 - */ public function getShareManager() { return $this->get(\OCP\Share\IManager::class); } @@ -2226,58 +1907,30 @@ class Server extends ServerContainer implements IServerContainer { return $this->get('LockdownManager'); } - /** - * @return \OCP\Federation\ICloudIdManager - * @deprecated 20.0.0 - */ public function getCloudIdManager() { return $this->get(ICloudIdManager::class); } - /** - * @return \OCP\GlobalScale\IConfig - * @deprecated 20.0.0 - */ public function getGlobalScaleConfig() { return $this->get(IConfig::class); } - /** - * @return \OCP\Federation\ICloudFederationProviderManager - * @deprecated 20.0.0 - */ public function getCloudFederationProviderManager() { return $this->get(ICloudFederationProviderManager::class); } - /** - * @return \OCP\Remote\Api\IApiFactory - * @deprecated 20.0.0 - */ public function getRemoteApiFactory() { return $this->get(IApiFactory::class); } - /** - * @return \OCP\Federation\ICloudFederationFactory - * @deprecated 20.0.0 - */ public function getCloudFederationFactory() { return $this->get(ICloudFederationFactory::class); } - /** - * @return \OCP\Remote\IInstanceFactory - * @deprecated 20.0.0 - */ public function getRemoteInstanceFactory() { return $this->get(IInstanceFactory::class); } - /** - * @return IStorageFactory - * @deprecated 20.0.0 - */ public function getStorageFactory() { return $this->get(IStorageFactory::class); } diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php index 323253af534..601501ac798 100644 --- a/lib/private/Session/CryptoSessionData.php +++ b/lib/private/Session/CryptoSessionData.php @@ -82,12 +82,6 @@ class CryptoSessionData implements \ArrayAccess, ISession { } } - /** - * Set a value in the session - * - * @param string $key - * @param mixed $value - */ public function set(string $key, $value) { if ($this->get($key) === $value) { // Do not write the session if the value hasn't changed to avoid reopening @@ -102,12 +96,6 @@ class CryptoSessionData implements \ArrayAccess, ISession { } } - /** - * Get a value from the session - * - * @param string $key - * @return string|null Either the value or null - */ public function get(string $key) { if (isset($this->sessionValues[$key])) { return $this->sessionValues[$key]; @@ -116,21 +104,10 @@ class CryptoSessionData implements \ArrayAccess, ISession { return null; } - /** - * Check if a named key exists in the session - * - * @param string $key - * @return bool - */ public function exists(string $key): bool { return isset($this->sessionValues[$key]); } - /** - * Remove a $key/$value pair from the session - * - * @param string $key - */ public function remove(string $key) { $reopened = $this->reopen(); $this->isModified = true; @@ -140,9 +117,6 @@ class CryptoSessionData implements \ArrayAccess, ISession { } } - /** - * Reset and recreate the session - */ public function clear() { $reopened = $this->reopen(); $requesttoken = $this->get('requesttoken'); @@ -165,31 +139,14 @@ class CryptoSessionData implements \ArrayAccess, ISession { return $reopened; } - /** - * Wrapper around session_regenerate_id - * - * @param bool $deleteOldSession Whether to delete the old associated session file or not. - * @param bool $updateToken Wheater to update the associated auth token - * @return void - */ public function regenerateId(bool $deleteOldSession = true, bool $updateToken = false) { $this->session->regenerateId($deleteOldSession, $updateToken); } - /** - * Wrapper around session_id - * - * @return string - * @throws SessionNotAvailableException - * @since 9.1.0 - */ public function getId(): string { return $this->session->getId(); } - /** - * Close the session and release the lock, also writes all changed data in batch - */ public function close() { if ($this->isModified) { $encryptedValue = $this->crypto->encrypt(json_encode($this->sessionValues), $this->passphrase); diff --git a/lib/private/Session/Session.php b/lib/private/Session/Session.php index b7510b63683..f7b91e7238d 100644 --- a/lib/private/Session/Session.php +++ b/lib/private/Session/Session.php @@ -51,9 +51,6 @@ abstract class Session implements \ArrayAccess, ISession { $this->remove($offset); } - /** - * Close the session and release the lock - */ public function close() { $this->sessionClosed = true; } diff --git a/lib/private/Settings/DeclarativeManager.php b/lib/private/Settings/DeclarativeManager.php index 5c2b868f417..555e60ee8a2 100644 --- a/lib/private/Settings/DeclarativeManager.php +++ b/lib/private/Settings/DeclarativeManager.php @@ -47,9 +47,6 @@ class DeclarativeManager implements IDeclarativeManager { */ private array $appSchemas = []; - /** - * @inheritdoc - */ public function registerSchema(string $app, array $schema): void { $this->appSchemas[$app] ??= []; @@ -73,9 +70,6 @@ class DeclarativeManager implements IDeclarativeManager { $this->appSchemas[$app][] = $schema; } - /** - * @inheritdoc - */ public function loadSchemas(): void { $declarativeSettings = $this->coordinator->getRegistrationContext()->getDeclarativeSettings(); foreach ($declarativeSettings as $declarativeSetting) { @@ -87,9 +81,6 @@ class DeclarativeManager implements IDeclarativeManager { $this->eventDispatcher->dispatchTyped(new DeclarativeSettingsRegisterFormEvent($this)); } - /** - * @inheritdoc - */ public function getFormIDs(IUser $user, string $type, string $section): array { $isAdmin = $this->groupManager->isAdmin($user->getUID()); /** @var array<string, list<string>> $formIds */ @@ -115,10 +106,6 @@ class DeclarativeManager implements IDeclarativeManager { return $formIds; } - /** - * @inheritdoc - * @throws Exception - */ public function getFormsWithValues(IUser $user, ?string $type, ?string $section): array { $isAdmin = $this->groupManager->isAdmin($user->getUID()); $forms = []; @@ -234,9 +221,6 @@ class DeclarativeManager implements IDeclarativeManager { } } - /** - * @inheritdoc - */ public function setValue(IUser $user, string $app, string $formId, string $fieldId, mixed $value): void { $sectionType = $this->getSectionType($app, $fieldId); $this->assertAuthorized($user, $sectionType); diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index c96b73474fa..97097da7373 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -70,9 +70,6 @@ class Manager implements IManager { /** @var array<self::SETTINGS_*, array<string, IIconSection>> */ protected $sections = []; - /** - * @inheritdoc - */ public function registerSection(string $type, string $section) { if (!isset($this->sectionClasses[$type])) { $this->sectionClasses[$type] = []; @@ -120,9 +117,6 @@ class Manager implements IManager { return $this->sections[$type]; } - /** - * @inheritdoc - */ public function getSection(string $type, string $sectionId): ?IIconSection { if (isset($this->sections[$type]) && isset($this->sections[$type][$sectionId])) { return $this->sections[$type][$sectionId]; @@ -143,9 +137,6 @@ class Manager implements IManager { /** @var array<self::SETTINGS_*, array<string, list<ISettings>>> */ protected $settings = []; - /** - * @inheritdoc - */ public function registerSetting(string $type, string $setting) { $this->settingClasses[$setting] = $type; } @@ -202,9 +193,6 @@ class Manager implements IManager { return $this->settings[$type][$section]; } - /** - * @inheritdoc - */ public function getAdminSections(): array { // built-in sections $sections = []; @@ -225,9 +213,6 @@ class Manager implements IManager { return $sections; } - /** - * @inheritdoc - */ public function getAdminSettings(string $section, bool $subAdminOnly = false): array { if ($subAdminOnly) { $subAdminSettingsFilter = function (ISettings $settings) { @@ -250,9 +235,6 @@ class Manager implements IManager { return $settings; } - /** - * @inheritdoc - */ public function getPersonalSections(): array { if ($this->l === null) { $this->l = $this->l10nFactory->get('lib'); @@ -296,9 +278,6 @@ class Manager implements IManager { return false; } - /** - * @inheritdoc - */ public function getPersonalSettings(string $section): array { $settings = []; $appSettings = $this->getSettings('personal', $section); @@ -314,9 +293,6 @@ class Manager implements IManager { return $settings; } - /** - * @inheritdoc - */ public function getAllowedAdminSettings(string $section, IUser $user): array { $isAdmin = $this->groupManager->isAdmin($user->getUID()); if ($isAdmin) { @@ -348,9 +324,6 @@ class Manager implements IManager { return $settings; } - /** - * @inheritdoc - */ public function getAllAllowedAdminSettings(IUser $user): array { $this->getSettings('admin', ''); // Make sure all the settings are loaded $settings = []; diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php index 9cc6523b9ae..1a82a217db6 100644 --- a/lib/private/Settings/Section.php +++ b/lib/private/Settings/Section.php @@ -30,39 +30,18 @@ class Section implements IIconSection { $this->icon = $icon; } - /** - * @return string The ID of the section. It is supposed to be a lower case string, - * e.g. 'ldap' - */ public function getID() { return $this->id; } - /** - * @return string The translated name as it should be displayed, e.g. 'LDAP / AD - * integration'. Use the L10N service to translate it. - */ public function getName() { return $this->name; } - /** - * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. - * - * E.g.: 70 - */ public function getPriority() { return $this->priority; } - /** - * @return string The relative path to an 16*16 icon describing the section. - * e.g. '/core/img/places/files.svg' - * - * @since 12 - */ public function getIcon() { return $this->icon; } diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 3ea429dfe3d..21607df4273 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -59,23 +59,10 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv ) { } - /** - * Return the identifier of this provider. - * - * @return string Containing only [a-zA-Z0-9] - */ public function identifier() { return 'ocinternal'; } - /** - * Share a path - * - * @param \OCP\Share\IShare $share - * @return \OCP\Share\IShare The share object - * @throws ShareNotFound - * @throws \Exception - */ public function create(\OCP\Share\IShare $share) { $qb = $this->dbConn->getQueryBuilder(); @@ -188,15 +175,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $share; } - /** - * Update a share - * - * @param \OCP\Share\IShare $share - * @return \OCP\Share\IShare The share object - * @throws ShareNotFound - * @throws \OCP\Files\InvalidPathException - * @throws \OCP\Files\NotFoundException - */ public function update(\OCP\Share\IShare $share) { $originalShare = $this->getShareById($share->getId()); @@ -294,14 +272,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $share; } - /** - * Accept a share. - * - * @param IShare $share - * @param string $recipient - * @return IShare The share object - * @since 9.0.0 - */ public function acceptShare(IShare $share, string $recipient): IShare { if ($share->getShareType() === IShare::TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); @@ -398,11 +368,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $children; } - /** - * Delete a share - * - * @param \OCP\Share\IShare $share - */ public function delete(\OCP\Share\IShare $share) { $qb = $this->dbConn->getQueryBuilder(); $qb->delete('share') @@ -419,15 +384,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv $qb->execute(); } - /** - * Unshare a share from the recipient. If this is a group share - * this means we need a special entry in the share db. - * - * @param IShare $share - * @param string $recipient UserId of recipient - * @throws BackendError - * @throws ProviderException - */ public function deleteFromSelf(IShare $share, $recipient) { if ($share->getShareType() === IShare::TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); @@ -511,12 +467,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $qb->getLastInsertId(); } - /** - * @inheritdoc - * - * For now this only works for group shares - * If this gets implemented for normal shares we have to extend it - */ public function restore(IShare $share, string $recipient): IShare { $qb = $this->dbConn->getQueryBuilder(); $qb->select('permissions') @@ -546,9 +496,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $this->getShareById($share->getId(), $recipient); } - /** - * @inheritdoc - */ public function move(\OCP\Share\IShare $share, $recipient) { if ($share->getShareType() === IShare::TYPE_USER) { // Just update the target @@ -686,9 +633,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $shares; } - /** - * @inheritdoc - */ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset) { $qb = $this->dbConn->getQueryBuilder(); $qb->select('*') @@ -737,9 +681,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $shares; } - /** - * @inheritdoc - */ public function getShareById($id, $recipientId = null) { $qb = $this->dbConn->getQueryBuilder(); @@ -783,12 +724,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $share; } - /** - * Get shares for a given path - * - * @param \OCP\Files\Node $path - * @return \OCP\Share\IShare[] - */ public function getSharesByPath(Node $path) { $qb = $this->dbConn->getQueryBuilder(); @@ -841,9 +776,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return true; } - /** - * @inheritdoc - */ public function getSharedWith($userId, $shareType, $node, $limit, $offset) { /** @var Share[] $shares */ $shares = []; @@ -973,13 +905,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return $shares; } - /** - * Get a share by token - * - * @param string $token - * @return \OCP\Share\IShare - * @throws ShareNotFound - */ public function getShareByToken($token) { $qb = $this->dbConn->getQueryBuilder(); @@ -1113,13 +1038,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv return array_values($shareMap); } - /** - * A user is deleted from the system - * So clean up the relevant shares. - * - * @param string $uid - * @param int $shareType - */ public function userDeleted($uid, $shareType) { $qb = $this->dbConn->getQueryBuilder(); @@ -1182,12 +1100,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv $qb->execute(); } - /** - * Delete all shares received by this group. As well as any custom group - * shares for group members. - * - * @param string $gid - */ public function groupDeleted($gid) { /* * First delete all custom group shares for group members @@ -1229,13 +1141,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv $qb->execute(); } - /** - * Delete custom group shares to this group for this user - * - * @param string $uid - * @param string $gid - * @return void - */ public function userDeletedFromGroup($uid, $gid) { /* * Get all group shares @@ -1311,9 +1216,6 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv } } - /** - * @inheritdoc - */ public function getAccessList($nodes, $currentAccess) { $ids = []; foreach ($nodes as $node) { diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 5457e8024a4..d4e0c86d6f6 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -601,15 +601,6 @@ class Manager implements IManager { } } - /** - * Share a path - * - * @param IShare $share - * @return IShare The share object - * @throws \Exception - * - * TODO: handle link share permissions or check them - */ public function createShare(IShare $share) { $this->canShare($share); @@ -747,13 +738,6 @@ class Manager implements IManager { return $share; } - /** - * Update a share - * - * @param IShare $share - * @return IShare The share object - * @throws \InvalidArgumentException - */ public function updateShare(IShare $share) { $expirationDateUpdated = false; @@ -894,15 +878,6 @@ class Manager implements IManager { return $share; } - /** - * Accept a share. - * - * @param IShare $share - * @param string $recipientId - * @return IShare The share object - * @throws \InvalidArgumentException Thrown if the provider does not implement `IShareProviderSupportsAccept` - * @since 9.0.0 - */ public function acceptShare(IShare $share, string $recipientId): IShare { [$providerId,] = $this->splitFullId($share->getFullId()); $provider = $this->factory->getProvider($providerId); @@ -1010,13 +985,6 @@ class Manager implements IManager { return $deletedShares; } - /** - * Delete a share - * - * @param IShare $share - * @throws ShareNotFound - * @throws \InvalidArgumentException - */ public function deleteShare(IShare $share) { try { $share->getFullId(); @@ -1037,15 +1005,6 @@ class Manager implements IManager { } - /** - * Unshare a file as the recipient. - * This can be different from a regular delete for example when one of - * the users in a groups deletes that share. But the provider should - * handle this. - * - * @param IShare $share - * @param string $recipientId - */ public function deleteFromSelf(IShare $share, $recipientId) { [$providerId,] = $this->splitFullId($share->getFullId()); $provider = $this->factory->getProvider($providerId); @@ -1062,9 +1021,6 @@ class Manager implements IManager { return $provider->restore($share, $recipientId); } - /** - * @inheritdoc - */ public function moveShare(IShare $share, $recipientId) { if ($share->getShareType() === IShare::TYPE_LINK || $share->getShareType() === IShare::TYPE_EMAIL) { @@ -1111,9 +1067,6 @@ class Manager implements IManager { }, []); } - /** - * @inheritdoc - */ public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) { if ($path !== null && !($path instanceof \OCP\Files\File) && @@ -1184,9 +1137,6 @@ class Manager implements IManager { return $shares; } - /** - * @inheritdoc - */ public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0) { try { $provider = $this->factory->getProviderForType($shareType); @@ -1208,9 +1158,6 @@ class Manager implements IManager { return $shares; } - /** - * @inheritdoc - */ public function getDeletedSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0) { $shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset); @@ -1227,9 +1174,6 @@ class Manager implements IManager { return $shares; } - /** - * @inheritdoc - */ public function getShareById($id, $recipient = null) { if ($id === null) { throw new ShareNotFound(); @@ -1263,14 +1207,6 @@ class Manager implements IManager { return []; } - /** - * Get the share by token possible with password - * - * @param string $token - * @return IShare - * - * @throws ShareNotFound - */ public function getShareByToken($token) { // tokens cannot be valid local user names if ($this->userManager->userExists($token)) { @@ -1363,13 +1299,6 @@ class Manager implements IManager { } } - /** - * Verify the password of a public share - * - * @param IShare $share - * @param ?string $password - * @return bool - */ public function checkPassword(IShare $share, $password) { // if there is no password on the share object / passsword is null, there is nothing to check @@ -1397,9 +1326,6 @@ class Manager implements IManager { return true; } - /** - * @inheritdoc - */ public function userDeleted($uid) { $types = [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_LINK, IShare::TYPE_REMOTE, IShare::TYPE_EMAIL]; @@ -1413,9 +1339,6 @@ class Manager implements IManager { } } - /** - * @inheritdoc - */ public function groupDeleted($gid) { $provider = $this->factory->getProviderForType(IShare::TYPE_GROUP); $provider->groupDeleted($gid); @@ -1434,62 +1357,11 @@ class Manager implements IManager { $this->config->setAppValue('core', 'shareapi_exclude_groups_list', json_encode($excludedGroups)); } - /** - * @inheritdoc - */ public function userDeletedFromGroup($uid, $gid) { $provider = $this->factory->getProviderForType(IShare::TYPE_GROUP); $provider->userDeletedFromGroup($uid, $gid); } - /** - * Get access list to a path. This means - * all the users that can access a given path. - * - * Consider: - * -root - * |-folder1 (23) - * |-folder2 (32) - * |-fileA (42) - * - * fileA is shared with user1 and user1@server1 and email1@maildomain1 - * folder2 is shared with group2 (user4 is a member of group2) - * folder1 is shared with user2 (renamed to "folder (1)") and user2@server2 - * and email2@maildomain2 - * - * Then the access list to '/folder1/folder2/fileA' with $currentAccess is: - * [ - * users => [ - * 'user1' => ['node_id' => 42, 'node_path' => '/fileA'], - * 'user4' => ['node_id' => 32, 'node_path' => '/folder2'], - * 'user2' => ['node_id' => 23, 'node_path' => '/folder (1)'], - * ], - * remote => [ - * 'user1@server1' => ['node_id' => 42, 'token' => 'SeCr3t'], - * 'user2@server2' => ['node_id' => 23, 'token' => 'FooBaR'], - * ], - * public => bool - * mail => [ - * 'email1@maildomain1' => ['node_id' => 42, 'token' => 'aBcDeFg'], - * 'email2@maildomain2' => ['node_id' => 23, 'token' => 'hIjKlMn'], - * ] - * ] - * - * The access list to '/folder1/folder2/fileA' **without** $currentAccess is: - * [ - * users => ['user1', 'user2', 'user4'], - * remote => bool, - * public => bool - * mail => ['email1@maildomain1', 'email2@maildomain2'] - * ] - * - * This is required for encryption/activity - * - * @param \OCP\Files\Node $path - * @param bool $recursive Should we check all parent folders as well - * @param bool $currentAccess Ensure the recipient has access to the file (e.g. did not unshare it) - * @return array - */ public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false) { $owner = $path->getOwner(); @@ -1574,29 +1446,14 @@ class Manager implements IManager { return $al; } - /** - * Create a new share - * - * @return IShare - */ public function newShare() { return new \OC\Share20\Share($this->rootFolder, $this->userManager); } - /** - * Is the share API enabled - * - * @return bool - */ public function shareApiEnabled() { return $this->config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes'; } - /** - * Is public link sharing enabled - * - * @return bool - */ public function shareApiAllowLinks() { if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') !== 'yes') { return false; @@ -1614,12 +1471,6 @@ class Manager implements IManager { return true; } - /** - * Is password on public link requires - * - * @param bool Check group membership exclusion - * @return bool - */ public function shareApiLinkEnforcePassword(bool $checkGroupMembership = true) { $excludedGroups = $this->config->getAppValue('core', 'shareapi_enforce_links_password_excluded_groups', ''); if ($excludedGroups !== '' && $checkGroupMembership) { @@ -1635,117 +1486,54 @@ class Manager implements IManager { return $this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'; } - /** - * Is default link expire date enabled - * - * @return bool - */ public function shareApiLinkDefaultExpireDate() { return $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; } - /** - * Is default link expire date enforced - *` - * - * @return bool - */ public function shareApiLinkDefaultExpireDateEnforced() { return $this->shareApiLinkDefaultExpireDate() && $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; } - /** - * Number of default link expire days - * - * @return int - */ public function shareApiLinkDefaultExpireDays() { return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); } - /** - * Is default internal expire date enabled - * - * @return bool - */ public function shareApiInternalDefaultExpireDate(): bool { return $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; } - /** - * Is default remote expire date enabled - * - * @return bool - */ public function shareApiRemoteDefaultExpireDate(): bool { return $this->config->getAppValue('core', 'shareapi_default_remote_expire_date', 'no') === 'yes'; } - /** - * Is default expire date enforced - * - * @return bool - */ public function shareApiInternalDefaultExpireDateEnforced(): bool { return $this->shareApiInternalDefaultExpireDate() && $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; } - /** - * Is default expire date enforced for remote shares - * - * @return bool - */ public function shareApiRemoteDefaultExpireDateEnforced(): bool { return $this->shareApiRemoteDefaultExpireDate() && $this->config->getAppValue('core', 'shareapi_enforce_remote_expire_date', 'no') === 'yes'; } - /** - * Number of default expire days - * - * @return int - */ public function shareApiInternalDefaultExpireDays(): int { return (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); } - /** - * Number of default expire days for remote shares - * - * @return int - */ public function shareApiRemoteDefaultExpireDays(): int { return (int)$this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); } - /** - * Allow public upload on link shares - * - * @return bool - */ public function shareApiLinkAllowPublicUpload() { return $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; } - /** - * check if user can only share with group members - * - * @return bool - */ public function shareWithGroupMembersOnly() { return $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; } - /** - * If shareWithGroupMembersOnly is enabled, return an optional - * list of groups that must be excluded from the principle of - * belonging to the same group. - * - * @return array - */ public function shareWithGroupMembersOnlyExcludeGroupsList() { if (!$this->shareWithGroupMembersOnly()) { return []; @@ -1754,11 +1542,6 @@ class Manager implements IManager { return json_decode($excludeGroups, true) ?? []; } - /** - * Check if users can share with groups - * - * @return bool - */ public function allowGroupSharing() { return $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; } @@ -1825,35 +1608,18 @@ class Manager implements IManager { return false; } - /** - * Copied from \OC_Util::isSharingDisabledForUser - * - * TODO: Deprecate function from OC_Util - * - * @param string $userId - * @return bool - */ public function sharingDisabledForUser($userId) { return $this->shareDisableChecker->sharingDisabledForUser($userId); } - /** - * @inheritdoc - */ public function outgoingServer2ServerSharesAllowed() { return $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; } - /** - * @inheritdoc - */ public function outgoingServer2ServerGroupSharesAllowed() { return $this->config->getAppValue('files_sharing', 'outgoing_server2server_group_share_enabled', 'no') === 'yes'; } - /** - * @inheritdoc - */ public function shareProviderExists($shareType) { try { $this->factory->getProviderForType($shareType); diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index e1a2c9a5375..d3c854f510f 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -258,9 +258,6 @@ class ProviderFactory implements IProviderFactory { return $this->roomShareProvider; } - /** - * @inheritdoc - */ public function getProvider($id) { $provider = null; if (isset($this->shareProviders[$id])) { @@ -303,9 +300,6 @@ class ProviderFactory implements IProviderFactory { return $provider; } - /** - * @inheritdoc - */ public function getProviderForType($shareType) { $provider = null; diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index 1c0b21b8038..cda41bd4345 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -82,9 +82,6 @@ class Share implements IShare { ) { } - /** - * @inheritdoc - */ public function setId($id) { /** @var mixed $id Let's be safe until strong typing */ if (is_int($id)) { @@ -103,16 +100,10 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getId() { return $this->id; } - /** - * @inheritdoc - */ public function getFullId() { if ($this->providerId === null || $this->id === null) { throw new \UnexpectedValueException; @@ -120,9 +111,6 @@ class Share implements IShare { return $this->providerId . ':' . $this->id; } - /** - * @inheritdoc - */ public function setProviderId($id) { if (!is_string($id)) { throw new \InvalidArgumentException('String expected.'); @@ -136,9 +124,6 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function setNode(Node $node) { $this->fileId = null; $this->nodeType = null; @@ -146,9 +131,6 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getNode() { if ($this->node === null) { if ($this->shareOwner === null || $this->fileId === null) { @@ -174,18 +156,12 @@ class Share implements IShare { return $this->node; } - /** - * @inheritdoc - */ public function setNodeId($fileId) { $this->node = null; $this->fileId = $fileId; return $this; } - /** - * @inheritdoc - */ public function getNodeId(): int { if ($this->fileId === null) { $this->fileId = $this->getNode()->getId(); @@ -198,9 +174,6 @@ class Share implements IShare { } } - /** - * @inheritdoc - */ public function setNodeType($type) { if ($type !== 'file' && $type !== 'folder') { throw new \InvalidArgumentException(); @@ -210,9 +183,6 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getNodeType() { if ($this->nodeType === null) { if ($this->getNodeCacheEntry()) { @@ -227,24 +197,15 @@ class Share implements IShare { return $this->nodeType; } - /** - * @inheritdoc - */ public function setShareType($shareType) { $this->shareType = $shareType; return $this; } - /** - * @inheritdoc - */ public function getShareType() { return $this->shareType; } - /** - * @inheritdoc - */ public function setSharedWith($sharedWith) { if (!is_string($sharedWith)) { throw new \InvalidArgumentException(); @@ -253,16 +214,10 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getSharedWith() { return $this->sharedWith; } - /** - * @inheritdoc - */ public function setSharedWithDisplayName($displayName) { if (!is_string($displayName)) { throw new \InvalidArgumentException(); @@ -271,16 +226,10 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getSharedWithDisplayName() { return $this->sharedWithDisplayName; } - /** - * @inheritdoc - */ public function setSharedWithAvatar($src) { if (!is_string($src)) { throw new \InvalidArgumentException(); @@ -289,16 +238,10 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getSharedWithAvatar() { return $this->sharedWithAvatar; } - /** - * @inheritdoc - */ public function setPermissions($permissions) { //TODO checks @@ -306,61 +249,37 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getPermissions() { return $this->permissions; } - /** - * @inheritdoc - */ public function newAttributes(): IAttributes { return new ShareAttributes(); } - /** - * @inheritdoc - */ public function setAttributes(?IAttributes $attributes) { $this->attributes = $attributes; return $this; } - /** - * @inheritdoc - */ public function getAttributes(): ?IAttributes { return $this->attributes; } - /** - * @inheritdoc - */ public function setStatus(int $status): IShare { $this->status = $status; return $this; } - /** - * @inheritdoc - */ public function getStatus(): int { return $this->status; } - /** - * @inheritdoc - */ public function setNote($note) { $this->note = $note; return $this; } - /** - * @inheritdoc - */ public function getNote() { if (is_string($this->note)) { return $this->note; @@ -368,24 +287,15 @@ class Share implements IShare { return ''; } - /** - * @inheritdoc - */ public function setLabel($label) { $this->label = $label; return $this; } - /** - * @inheritdoc - */ public function getLabel() { return $this->label; } - /** - * @inheritdoc - */ public function setExpirationDate($expireDate) { //TODO checks @@ -393,39 +303,24 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getExpirationDate() { return $this->expireDate; } - /** - * @inheritdoc - */ public function setNoExpirationDate(bool $noExpirationDate) { $this->noExpirationDate = $noExpirationDate; return $this; } - /** - * @inheritdoc - */ public function getNoExpirationDate(): bool { return $this->noExpirationDate; } - /** - * @inheritdoc - */ public function isExpired() { return $this->getExpirationDate() !== null && $this->getExpirationDate() <= new \DateTime(); } - /** - * @inheritdoc - */ public function setSharedBy($sharedBy) { if (!is_string($sharedBy)) { throw new \InvalidArgumentException(); @@ -436,17 +331,11 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getSharedBy() { //TODO check if set return $this->sharedBy; } - /** - * @inheritdoc - */ public function setShareOwner($shareOwner) { if (!is_string($shareOwner)) { throw new \InvalidArgumentException(); @@ -457,70 +346,43 @@ class Share implements IShare { return $this; } - /** - * @inheritdoc - */ public function getShareOwner() { //TODO check if set return $this->shareOwner; } - /** - * @inheritdoc - */ public function setPassword($password) { $this->password = $password; return $this; } - /** - * @inheritdoc - */ public function getPassword() { return $this->password; } - /** - * @inheritdoc - */ public function setPasswordExpirationTime(?\DateTimeInterface $passwordExpirationTime = null): IShare { $this->passwordExpirationTime = $passwordExpirationTime; return $this; } - /** - * @inheritdoc - */ public function getPasswordExpirationTime(): ?\DateTimeInterface { return $this->passwordExpirationTime; } - /** - * @inheritdoc - */ public function setSendPasswordByTalk(bool $sendPasswordByTalk) { $this->sendPasswordByTalk = $sendPasswordByTalk; return $this; } - /** - * @inheritdoc - */ public function getSendPasswordByTalk(): bool { return $this->sendPasswordByTalk; } - /** - * @inheritdoc - */ public function setToken($token) { $this->token = $token; return $this; } - /** - * @inheritdoc - */ public function getToken() { return $this->token; } @@ -547,61 +409,37 @@ class Share implements IShare { return $this->parent; } - /** - * @inheritdoc - */ public function setTarget($target) { $this->target = $target; return $this; } - /** - * @inheritdoc - */ public function getTarget() { return $this->target; } - /** - * @inheritdoc - */ public function setShareTime(\DateTime $shareTime) { $this->shareTime = $shareTime; return $this; } - /** - * @inheritdoc - */ public function getShareTime() { return $this->shareTime; } - /** - * @inheritdoc - */ public function setMailSend($mailSend) { $this->mailSend = $mailSend; return $this; } - /** - * @inheritdoc - */ public function getMailSend() { return $this->mailSend; } - /** - * @inheritdoc - */ public function setNodeCacheEntry(ICacheEntry $entry) { $this->nodeCacheEntry = $entry; } - /** - * @inheritdoc - */ public function getNodeCacheEntry() { return $this->nodeCacheEntry; } diff --git a/lib/private/Share20/ShareAttributes.php b/lib/private/Share20/ShareAttributes.php index 96da1e336e3..39c2a1e419f 100644 --- a/lib/private/Share20/ShareAttributes.php +++ b/lib/private/Share20/ShareAttributes.php @@ -17,9 +17,6 @@ class ShareAttributes implements IAttributes { $this->attributes = []; } - /** - * @inheritdoc - */ public function setAttribute(string $scope, string $key, mixed $value): IAttributes { if (!\array_key_exists($scope, $this->attributes)) { $this->attributes[$scope] = []; @@ -28,9 +25,6 @@ class ShareAttributes implements IAttributes { return $this; } - /** - * @inheritdoc - */ public function getAttribute(string $scope, string $key): mixed { if (\array_key_exists($scope, $this->attributes) && \array_key_exists($key, $this->attributes[$scope])) { @@ -39,9 +33,6 @@ class ShareAttributes implements IAttributes { return null; } - /** - * @inheritdoc - */ public function toArray(): array { $result = []; foreach ($this->attributes as $scope => $keys) { diff --git a/lib/private/Share20/ShareHelper.php b/lib/private/Share20/ShareHelper.php index d4a54f1d687..2a43481bee7 100644 --- a/lib/private/Share20/ShareHelper.php +++ b/lib/private/Share20/ShareHelper.php @@ -20,10 +20,6 @@ class ShareHelper implements IShareHelper { $this->shareManager = $shareManager; } - /** - * @param Node $node - * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]] - */ public function getPathsForAccessList(Node $node) { $result = [ 'users' => [], diff --git a/lib/private/StreamImage.php b/lib/private/StreamImage.php index 34fe590efbd..747d553ae04 100644 --- a/lib/private/StreamImage.php +++ b/lib/private/StreamImage.php @@ -38,22 +38,18 @@ class StreamImage implements IStreamImage { $this->height = $height; } - /** @inheritDoc */ public function valid(): bool { return is_resource($this->stream); } - /** @inheritDoc */ public function mimeType(): ?string { return $this->mimeType; } - /** @inheritDoc */ public function width(): int { return $this->width; } - /** @inheritDoc */ public function height(): int { return $this->height; } diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index c025ab7b012..1bc277b72a1 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -53,11 +53,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { }); } - /** - * add a SubAdmin - * @param IUser $user user to be SubAdmin - * @param IGroup $group group $user becomes subadmin of - */ public function createSubAdmin(IUser $user, IGroup $group): void { $qb = $this->dbConn->getQueryBuilder(); @@ -74,11 +69,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { $this->eventDispatcher->dispatchTyped($event); } - /** - * delete a SubAdmin - * @param IUser $user the user that is the SubAdmin - * @param IGroup $group the group - */ public function deleteSubAdmin(IUser $user, IGroup $group): void { $qb = $this->dbConn->getQueryBuilder(); @@ -93,11 +83,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { $this->eventDispatcher->dispatchTyped($event); } - /** - * get groups of a SubAdmin - * @param IUser $user the SubAdmin - * @return IGroup[] - */ public function getSubAdminsGroups(IUser $user): array { $groupIds = $this->getSubAdminsGroupIds($user); @@ -145,11 +130,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { }, $this->getSubAdminsGroups($user)); } - /** - * get SubAdmins of a group - * @param IGroup $group the group - * @return IUser[] - */ public function getGroupsSubAdmins(IGroup $group): array { $qb = $this->dbConn->getQueryBuilder(); @@ -197,12 +177,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { return $subadmins; } - /** - * checks if a user is a SubAdmin of a group - * @param IUser $user - * @param IGroup $group - * @return bool - */ public function isSubAdminOfGroup(IUser $user, IGroup $group): bool { $qb = $this->dbConn->getQueryBuilder(); @@ -222,11 +196,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { return $result; } - /** - * checks if a user is a SubAdmin - * @param IUser $user - * @return bool - */ public function isSubAdmin(IUser $user): bool { // Check if the user is already an admin if ($this->groupManager->isAdmin($user->getUID())) { @@ -252,12 +221,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { return $isSubAdmin !== false; } - /** - * checks if a user is a accessible by a subadmin - * @param IUser $subadmin - * @param IUser $user - * @return bool - */ public function isUserAccessible(IUser $subadmin, IUser $user): bool { if (!$this->isSubAdmin($subadmin)) { return false; diff --git a/lib/private/Support/CrashReport/Registry.php b/lib/private/Support/CrashReport/Registry.php index 93969a81265..c619c784956 100644 --- a/lib/private/Support/CrashReport/Registry.php +++ b/lib/private/Support/CrashReport/Registry.php @@ -8,7 +8,6 @@ declare(strict_types=1); */ namespace OC\Support\CrashReport; -use Exception; use OCP\AppFramework\QueryException; use OCP\IServerContainer; use OCP\Support\CrashReport\ICollectBreadcrumbs; @@ -33,11 +32,6 @@ class Registry implements IRegistry { $this->serverContainer = $serverContainer; } - /** - * Register a reporter instance - * - * @param IReporter $reporter - */ public function register(IReporter $reporter): void { $this->reporters[] = $reporter; } @@ -46,15 +40,6 @@ class Registry implements IRegistry { $this->lazyReporters[] = $class; } - /** - * Delegate breadcrumb collection to all registered reporters - * - * @param string $message - * @param string $category - * @param array $context - * - * @since 15.0.0 - */ public function delegateBreadcrumb(string $message, string $category, array $context = []): void { $this->loadLazyProviders(); @@ -65,12 +50,6 @@ class Registry implements IRegistry { } } - /** - * Delegate crash reporting to all registered reporters - * - * @param Exception|Throwable $exception - * @param array $context - */ public function delegateReport($exception, array $context = []): void { $this->loadLazyProviders(); @@ -79,14 +58,6 @@ class Registry implements IRegistry { } } - /** - * Delegate a message to all reporters that implement IMessageReporter - * - * @param string $message - * @param array $context - * - * @return void - */ public function delegateMessage(string $message, array $context = []): void { $this->loadLazyProviders(); diff --git a/lib/private/Support/Subscription/Assertion.php b/lib/private/Support/Subscription/Assertion.php index 04a0dde739f..8b2895ed861 100644 --- a/lib/private/Support/Subscription/Assertion.php +++ b/lib/private/Support/Subscription/Assertion.php @@ -24,9 +24,6 @@ class Assertion implements IAssertion { $this->notificationManager = $notificationManager; } - /** - * @inheritDoc - */ public function createUserIsLegit(): void { if ($this->registry->delegateIsHardUserLimitReached($this->notificationManager)) { $l = $this->l10nFactory->get('lib'); diff --git a/lib/private/Support/Subscription/Registry.php b/lib/private/Support/Subscription/Registry.php index 3d3daa97abb..f867ebb2cfe 100644 --- a/lib/private/Support/Subscription/Registry.php +++ b/lib/private/Support/Subscription/Registry.php @@ -66,15 +66,6 @@ class Registry implements IRegistry { return $this->subscription; } - /** - * Register a subscription instance. In case it is called multiple times the - * first one is used. - * - * @param ISubscription $subscription - * @throws AlreadyRegisteredException - * - * @since 17.0.0 - */ public function register(ISubscription $subscription): void { if ($this->subscription !== null || $this->subscriptionService !== null) { throw new AlreadyRegisteredException(); @@ -91,11 +82,6 @@ class Registry implements IRegistry { } - /** - * Fetches the list of app IDs that are supported by the subscription - * - * @since 17.0.0 - */ public function delegateGetSupportedApps(): array { if ($this->getSubscription() instanceof ISupportedApps) { return $this->getSubscription()->getSupportedApps(); @@ -103,11 +89,6 @@ class Registry implements IRegistry { return []; } - /** - * Indicates if a valid subscription is available - * - * @since 17.0.0 - */ public function delegateHasValidSubscription(): bool { // Allow overwriting this manually for environments where the subscription information cannot be fetched if ($this->config->getSystemValueBool('has_valid_subscription')) { @@ -120,11 +101,6 @@ class Registry implements IRegistry { return false; } - /** - * Indicates if the subscription has extended support - * - * @since 17.0.0 - */ public function delegateHasExtendedSupport(): bool { if ($this->getSubscription() instanceof ISubscription) { return $this->getSubscription()->hasExtendedSupport(); @@ -133,12 +109,6 @@ class Registry implements IRegistry { } - /** - * Indicates if a hard user limit is reached and no new users should be created - * - * @param IManager|null $notificationManager - * @since 21.0.0 - */ public function delegateIsHardUserLimitReached(?IManager $notificationManager = null): bool { $subscription = $this->getSubscription(); if ($subscription instanceof ISubscription && diff --git a/lib/private/SystemTag/ManagerFactory.php b/lib/private/SystemTag/ManagerFactory.php index 0fd2ca5fd36..093cc76eef9 100644 --- a/lib/private/SystemTag/ManagerFactory.php +++ b/lib/private/SystemTag/ManagerFactory.php @@ -21,19 +21,11 @@ use OCP\SystemTag\ISystemTagObjectMapper; * @since 9.0.0 */ class ManagerFactory implements ISystemTagManagerFactory { - /** - * Constructor for the system tag manager factory - */ public function __construct( private IServerContainer $serverContainer, ) { } - /** - * Creates and returns an instance of the system tag manager - * - * @since 9.0.0 - */ public function getManager(): ISystemTagManager { return new SystemTagManager( $this->serverContainer->getDatabaseConnection(), @@ -42,12 +34,6 @@ class ManagerFactory implements ISystemTagManagerFactory { ); } - /** - * Creates and returns an instance of the system tag object - * mapper - * - * @since 9.0.0 - */ public function getObjectMapper(): ISystemTagObjectMapper { return new SystemTagObjectMapper( $this->serverContainer->getDatabaseConnection(), diff --git a/lib/private/SystemTag/SystemTag.php b/lib/private/SystemTag/SystemTag.php index 83fb6bc7f93..7eac8a89b83 100644 --- a/lib/private/SystemTag/SystemTag.php +++ b/lib/private/SystemTag/SystemTag.php @@ -19,37 +19,22 @@ class SystemTag implements ISystemTag { ) { } - /** - * {@inheritdoc} - */ public function getId(): string { return $this->id; } - /** - * {@inheritdoc} - */ public function getName(): string { return $this->name; } - /** - * {@inheritdoc} - */ public function isUserVisible(): bool { return $this->userVisible; } - /** - * {@inheritdoc} - */ public function isUserAssignable(): bool { return $this->userAssignable; } - /** - * {@inheritdoc} - */ public function getAccessLevel(): int { if (!$this->userVisible) { return self::ACCESS_LEVEL_INVISIBLE; diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index e99213b618b..3d524f09c96 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -45,9 +45,6 @@ class SystemTagManager implements ISystemTagManager { ->andWhere($query->expr()->eq('editable', $query->createParameter('editable'))); } - /** - * {@inheritdoc} - */ public function getTagsByIds($tagIds, ?IUser $user = null): array { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -92,9 +89,6 @@ class SystemTagManager implements ISystemTagManager { return $tags; } - /** - * {@inheritdoc} - */ public function getAllTags($visibilityFilter = null, $nameSearchPattern = null): array { $tags = []; @@ -130,9 +124,6 @@ class SystemTagManager implements ISystemTagManager { return $tags; } - /** - * {@inheritdoc} - */ public function getTag(string $tagName, bool $userVisible, bool $userAssignable): ISystemTag { // Length of name column is 64 $truncatedTagName = substr($tagName, 0, 64); @@ -153,9 +144,6 @@ class SystemTagManager implements ISystemTagManager { return $this->createSystemTagFromRow($row); } - /** - * {@inheritdoc} - */ public function createTag(string $tagName, bool $userVisible, bool $userAssignable): ISystemTag { // Length of name column is 64 $truncatedTagName = substr($tagName, 0, 64); @@ -193,9 +181,6 @@ class SystemTagManager implements ISystemTagManager { return $tag; } - /** - * {@inheritdoc} - */ public function updateTag( string $tagId, string $newName, @@ -250,9 +235,6 @@ class SystemTagManager implements ISystemTagManager { )); } - /** - * {@inheritdoc} - */ public function deleteTags($tagIds): void { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -302,9 +284,6 @@ class SystemTagManager implements ISystemTagManager { } } - /** - * {@inheritdoc} - */ public function canUserAssignTag(ISystemTag $tag, IUser $user): bool { // early check to avoid unneeded group lookups if ($tag->isUserAssignable() && $tag->isUserVisible()) { @@ -330,9 +309,6 @@ class SystemTagManager implements ISystemTagManager { return false; } - /** - * {@inheritdoc} - */ public function canUserSeeTag(ISystemTag $tag, IUser $user): bool { if ($tag->isUserVisible()) { return true; @@ -349,9 +325,6 @@ class SystemTagManager implements ISystemTagManager { return new SystemTag((string)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable']); } - /** - * {@inheritdoc} - */ public function setTagGroups(ISystemTag $tag, array $groupIds): void { // delete relationships first $this->connection->beginTransaction(); @@ -383,9 +356,6 @@ class SystemTagManager implements ISystemTagManager { } } - /** - * {@inheritdoc} - */ public function getTagGroups(ISystemTag $tag): array { $groupIds = []; $query = $this->connection->getQueryBuilder(); diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index 157948e6e0c..63414524b46 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -29,9 +29,6 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { ) { } - /** - * {@inheritdoc} - */ public function getTagIdsForObjects($objIds, string $objectType): array { if (!\is_array($objIds)) { $objIds = [$objIds]; @@ -66,9 +63,6 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { return $mapping; } - /** - * {@inheritdoc} - */ public function getObjectIdsForTags($tagIds, string $objectType, int $limit = 0, string $offset = ''): array { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -106,9 +100,6 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { return $objectIds; } - /** - * {@inheritdoc} - */ public function assignTags(string $objId, string $objectType, $tagIds): void { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -169,9 +160,6 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { )); } - /** - * {@inheritdoc} - */ public function unassignTags(string $objId, string $objectType, $tagIds): void { if (!\is_array($tagIds)) { $tagIds = [$tagIds]; @@ -197,9 +185,6 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { )); } - /** - * {@inheritdoc} - */ public function haveTag($objIds, string $objectType, string $tagId, bool $all = true): bool { $this->assertTagsExist([$tagId]); diff --git a/lib/private/TagManager.php b/lib/private/TagManager.php index f99653f2c05..2c4290da66b 100644 --- a/lib/private/TagManager.php +++ b/lib/private/TagManager.php @@ -35,19 +35,6 @@ class TagManager implements ITagManager, IEventListener { $this->logger = $logger; } - /** - * Create a new \OCP\ITags instance and load tags from db. - * - * @see \OCP\ITags - * @param string $type The type identifier e.g. 'contact' or 'event'. - * @param array $defaultTags An array of default tags to be used if none are stored. - * @param boolean $includeShared Whether to include tags for items shared with this user by others. - * @param string $userId user for which to retrieve the tags, defaults to the currently - * logged in user - * @return \OCP\ITags - * - * since 20.0.0 $includeShared isn't used anymore - */ public function load($type, $defaultTags = [], $includeShared = false, $userId = null) { if (is_null($userId)) { $user = $this->userSession->getUser(); diff --git a/lib/private/Tags.php b/lib/private/Tags.php index 20fd644132b..19c56fd86d4 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -76,22 +76,10 @@ class Tags implements ITags { } } - /** - * Check if any tags are saved for this type and user. - * - * @return boolean - */ public function isEmpty(): bool { return count($this->tags) === 0; } - /** - * Returns an array mapping a given tag's properties to its values: - * ['id' => 0, 'name' = 'Tag', 'owner' = 'User', 'type' => 'tagtype'] - * - * @param string $id The ID of the tag that is going to be mapped - * @return array|false - */ public function getTag(string $id) { $key = $this->getTagById($id); if ($key !== false) { @@ -100,17 +88,6 @@ class Tags implements ITags { return false; } - /** - * Get the tags for a specific user. - * - * This returns an array with maps containing each tag's properties: - * [ - * ['id' => 0, 'name' = 'First tag', 'owner' = 'User', 'type' => 'tagtype'], - * ['id' => 1, 'name' = 'Shared tag', 'owner' = 'Other user', 'type' => 'tagtype'], - * ] - * - * @return array<array-key, array{id: int, name: string}> - */ public function getTags(): array { if (!count($this->tags)) { return []; @@ -144,13 +121,6 @@ class Tags implements ITags { ); } - /** - * Get the list of tags for the given ids. - * - * @param array $objIds array of object ids - * @return array|false of tags id as key to array of tag names - * or false if an error occurred - */ public function getTagsForObjects(array $objIds) { $entries = []; @@ -188,15 +158,6 @@ class Tags implements ITags { return $entries; } - /** - * Get the a list if items tagged with $tag. - * - * Throws an exception if the tag could not be found. - * - * @param string $tag Tag id or name. - * @return int[]|false An array of object ids or false on error. - * @throws \Exception - */ public function getIdsForTag($tag) { $tagId = false; if (is_numeric($tag)) { @@ -240,33 +201,15 @@ class Tags implements ITags { return $ids; } - /** - * Checks whether a tag is saved for the given user, - * disregarding the ones shared with him or her. - * - * @param string $name The tag name to check for. - * @param string $user The user whose tags are to be checked. - */ public function userHasTag(string $name, string $user): bool { $key = $this->array_searchi($name, $this->getTagsForUser($user)); return ($key !== false) ? $this->tags[$key]->getId() : false; } - /** - * Checks whether a tag is saved for or shared with the current user. - * - * @param string $name The tag name to check for. - */ public function hasTag(string $name): bool { return $this->getTagId($name) !== false; } - /** - * Add a new tag. - * - * @param string $name A string with a name of the tag - * @return false|int the id of the added tag or false on error. - */ public function add(string $name) { $name = trim($name); @@ -294,13 +237,6 @@ class Tags implements ITags { return $tag->getId(); } - /** - * Rename tag. - * - * @param string|integer $from The name or ID of the existing tag - * @param string $to The new name of the tag. - * @return bool - */ public function rename($from, string $to): bool { $from = trim($from); $to = trim($to); @@ -339,15 +275,6 @@ class Tags implements ITags { return true; } - /** - * Add a list of new tags. - * - * @param string|string[] $names A string with a name or an array of strings containing - * the name(s) of the tag(s) to add. - * @param bool $sync When true, save the tags - * @param int|null $id int Optional object id to add to this|these tag(s) - * @return bool Returns false on error. - */ public function addMultiple($names, bool $sync = false, ?int $id = null): bool { if (!is_array($names)) { $names = [$names]; @@ -422,12 +349,6 @@ class Tags implements ITags { self::$relations = []; // reset } - /** - * Delete tag/object relations from the db - * - * @param array $ids The ids of the objects - * @return boolean Returns false on error. - */ public function purgeObjects(array $ids): bool { if (count($ids) === 0) { // job done ;) @@ -449,11 +370,6 @@ class Tags implements ITags { return true; } - /** - * Get favorites for an object type - * - * @return array|false An array of object ids. - */ public function getFavorites() { if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { return []; @@ -473,12 +389,6 @@ class Tags implements ITags { } } - /** - * Add an object to favorites - * - * @param int $objid The id of the object - * @return boolean - */ public function addToFavorites($objid) { if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { $this->add(ITags::TAG_FAVORITE); @@ -486,23 +396,10 @@ class Tags implements ITags { return $this->tagAs($objid, ITags::TAG_FAVORITE); } - /** - * Remove an object from favorites - * - * @param int $objid The id of the object - * @return boolean - */ public function removeFromFavorites($objid) { return $this->unTag($objid, ITags::TAG_FAVORITE); } - /** - * Creates a tag/object relation. - * - * @param int $objid The id of the object - * @param string $tag The id or name of the tag - * @return boolean Returns false on error. - */ public function tagAs($objid, $tag) { if (is_string($tag) && !is_numeric($tag)) { $tag = trim($tag); @@ -536,13 +433,6 @@ class Tags implements ITags { return true; } - /** - * Delete single tag/object relation from the db - * - * @param int $objid The id of the object - * @param string $tag The id or name of the tag - * @return boolean - */ public function unTag($objid, $tag) { if (is_string($tag) && !is_numeric($tag)) { $tag = trim($tag); @@ -573,12 +463,6 @@ class Tags implements ITags { return true; } - /** - * Delete tags from the database. - * - * @param string[]|integer[] $names An array of tags (names or IDs) to delete - * @return bool Returns false on error - */ public function delete($names) { if (!is_array($names)) { $names = [$names]; diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 29153ca56f9..3f1cb7f52a9 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1112,14 +1112,6 @@ class Manager implements IManager { return $newOutput; } - /** - * @param Task $task - * @return array<array-key, list<numeric|string|File>|numeric|string|File> - * @throws GenericFileException - * @throws LockedException - * @throws NotPermittedException - * @throws ValidationException|UnauthorizedException - */ public function prepareInputData(Task $task): array { $taskTypes = $this->getAvailableTaskTypes(); $inputShape = $taskTypes[$task->getTaskTypeId()]['inputShape']; @@ -1139,10 +1131,6 @@ class Manager implements IManager { return true; } - /** - * @throws \JsonException - * @throws Exception - */ public function setTaskStatus(Task $task, int $status): void { $currentTaskStatus = $task->getStatus(); if ($currentTaskStatus === Task::STATUS_SCHEDULED && $status === Task::STATUS_RUNNING) { diff --git a/lib/private/TempManager.php b/lib/private/TempManager.php index 74b4d6b1f24..2f77e82d20d 100644 --- a/lib/private/TempManager.php +++ b/lib/private/TempManager.php @@ -52,12 +52,6 @@ class TempManager implements ITempManager { return $absolutePath . $postFix; } - /** - * Create a temporary file and return the path - * - * @param string $postFix Postfix appended to the temporary file name - * @return string - */ public function getTemporaryFile($postFix = '') { if (is_writable($this->tmpBaseDir)) { // To create an unique file and prevent the risk of race conditions @@ -89,12 +83,6 @@ class TempManager implements ITempManager { } } - /** - * Create a temporary folder and return the path - * - * @param string $postFix Postfix appended to the temporary folder name - * @return string - */ public function getTemporaryFolder($postFix = '') { if (is_writable($this->tmpBaseDir)) { // To create an unique directory and prevent the risk of race conditions @@ -121,9 +109,6 @@ class TempManager implements ITempManager { } } - /** - * Remove the temporary files and folders generated during this request - */ public function clean() { $this->cleanFiles($this->current); } @@ -149,9 +134,6 @@ class TempManager implements ITempManager { } } - /** - * Remove old temporary files and folders that were failed to be cleaned - */ public function cleanOld() { $this->cleanFiles($this->getOldFiles()); } @@ -179,12 +161,6 @@ class TempManager implements ITempManager { return $files; } - /** - * Get the temporary base directory configured on the server - * - * @return string Path to the temporary directory or null - * @throws \UnexpectedValueException - */ public function getTempBaseDir() { if ($this->tmpBaseDir) { return $this->tmpBaseDir; diff --git a/lib/private/TextProcessing/Manager.php b/lib/private/TextProcessing/Manager.php index 9801a99ddec..983b62ab155 100644 --- a/lib/private/TextProcessing/Manager.php +++ b/lib/private/TextProcessing/Manager.php @@ -89,9 +89,6 @@ class Manager implements IManager { return count($context->getTextProcessingProviders()) > 0; } - /** - * @inheritDoc - */ public function getAvailableTaskTypes(): array { $tasks = []; foreach ($this->getProviders() as $provider) { @@ -104,9 +101,6 @@ class Manager implements IManager { return in_array($task->getType(), $this->getAvailableTaskTypes()); } - /** - * @inheritDoc - */ public function runTask(OCPTask $task): string { // try to run a task processing task if possible $taskTypeClass = $task->getType(); @@ -194,9 +188,6 @@ class Manager implements IManager { throw new TaskFailureException('Could not run task'); } - /** - * @inheritDoc - */ public function scheduleTask(OCPTask $task): void { if (!$this->canHandleTask($task)) { throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task'); @@ -220,9 +211,6 @@ class Manager implements IManager { ]); } - /** - * @inheritDoc - */ public function runOrScheduleTask(OCPTask $task): bool { if (!$this->canHandleTask($task)) { throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task'); @@ -239,9 +227,6 @@ class Manager implements IManager { return true; } - /** - * @inheritDoc - */ public function deleteTask(Task $task): void { $taskEntity = DbTask::fromPublicTask($task); $this->taskMapper->delete($taskEntity); @@ -250,14 +235,6 @@ class Manager implements IManager { ]); } - /** - * Get a task from its id - * - * @param int $id The id of the task - * @return OCPTask - * @throws RuntimeException If the query failed - * @throws NotFoundException If the task could not be found - */ public function getTask(int $id): OCPTask { try { $taskEntity = $this->taskMapper->find($id); @@ -271,16 +248,6 @@ class Manager implements IManager { } } - /** - * Get a task from its user id and task id - * If userId is null, this can only get a task that was scheduled anonymously - * - * @param int $id The id of the task - * @param string|null $userId The user id that scheduled the task - * @return OCPTask - * @throws RuntimeException If the query failed - * @throws NotFoundException If the task could not be found - */ public function getUserTask(int $id, ?string $userId): OCPTask { try { $taskEntity = $this->taskMapper->findByIdAndUser($id, $userId); @@ -294,16 +261,6 @@ class Manager implements IManager { } } - /** - * Get a list of tasks scheduled by a specific user for a specific app - * and optionally with a specific identifier. - * This cannot be used to get anonymously scheduled tasks - * - * @param string $userId - * @param string $appId - * @param string|null $identifier - * @return array - */ public function getUserTasksByApp(string $userId, string $appId, ?string $identifier = null): array { try { $taskEntities = $this->taskMapper->findUserTasksByApp($userId, $appId, $identifier); diff --git a/lib/private/TextToImage/Manager.php b/lib/private/TextToImage/Manager.php index 88dc108f380..70633891f7f 100644 --- a/lib/private/TextToImage/Manager.php +++ b/lib/private/TextToImage/Manager.php @@ -50,9 +50,6 @@ class Manager implements IManager { $this->appData = $appDataFactory->get('core'); } - /** - * @inheritDoc - */ public function getProviders(): array { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -81,9 +78,6 @@ class Manager implements IManager { return $this->providers; } - /** - * @inheritDoc - */ public function hasProviders(): bool { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { @@ -92,9 +86,6 @@ class Manager implements IManager { return count($context->getTextToImageProviders()) > 0; } - /** - * @inheritDoc - */ public function runTask(Task $task): void { $this->logger->debug('Running TextToImage Task'); if (!$this->hasProviders()) { @@ -188,9 +179,6 @@ class Manager implements IManager { throw new TaskFailureException('Could not run task'); } - /** - * @inheritDoc - */ public function scheduleTask(Task $task): void { if (!$this->hasProviders()) { throw new PreConditionNotMetException('No text to image provider is installed that can handle this task'); @@ -208,9 +196,6 @@ class Manager implements IManager { ]); } - /** - * @inheritDoc - */ public function runOrScheduleTask(Task $task) : void { if (!$this->hasProviders()) { throw new PreConditionNotMetException('No text to image provider is installed that can handle this task'); @@ -225,9 +210,6 @@ class Manager implements IManager { $this->runTask($task); } - /** - * @inheritDoc - */ public function deleteTask(Task $task): void { $taskEntity = DbTask::fromPublicTask($task); $this->taskMapper->delete($taskEntity); @@ -236,14 +218,6 @@ class Manager implements IManager { ]); } - /** - * Get a task from its id - * - * @param int $id The id of the task - * @return Task - * @throws RuntimeException If the query failed - * @throws TaskNotFoundException If the task could not be found - */ public function getTask(int $id): Task { try { $taskEntity = $this->taskMapper->find($id); @@ -257,16 +231,6 @@ class Manager implements IManager { } } - /** - * Get a task from its user id and task id - * If userId is null, this can only get a task that was scheduled anonymously - * - * @param int $id The id of the task - * @param string|null $userId The user id that scheduled the task - * @return Task - * @throws RuntimeException If the query failed - * @throws TaskNotFoundException If the task could not be found - */ public function getUserTask(int $id, ?string $userId): Task { try { $taskEntity = $this->taskMapper->findByIdAndUser($id, $userId); @@ -280,17 +244,6 @@ class Manager implements IManager { } } - /** - * Get a list of tasks scheduled by a specific user for a specific app - * and optionally with a specific identifier. - * This cannot be used to get anonymously scheduled tasks - * - * @param string $userId - * @param string $appId - * @param string|null $identifier - * @return Task[] - * @throws RuntimeException - */ public function getUserTasksByApp(?string $userId, string $appId, ?string $identifier = null): array { try { $taskEntities = $this->taskMapper->findUserTasksByApp($userId, $appId, $identifier); diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 1ddc9aaa0e1..2d0eabad174 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -58,27 +58,10 @@ class URLGenerator implements IURLGenerator { return $this->appManager; } - /** - * Creates an url using a defined route - * - * @param string $routeName - * @param array $arguments args with param=>value, will be appended to the returned url - * @return string the url - * - * Returns a url to the given route. - */ public function linkToRoute(string $routeName, array $arguments = []): string { return $this->router->generate($routeName, $arguments); } - /** - * Creates an absolute url using a defined route - * @param string $routeName - * @param array $arguments args with param=>value, will be appended to the returned url - * @return string the url - * - * Returns an absolute url to the given route. - */ public function linkToRouteAbsolute(string $routeName, array $arguments = []): string { return $this->getAbsoluteURL($this->linkToRoute($routeName, $arguments)); } @@ -106,17 +89,6 @@ class URLGenerator implements IURLGenerator { return $this->getAbsoluteURL($route); } - /** - * Creates an url - * - * @param string $appName app - * @param string $file file - * @param array $args array with param=>value, will be appended to the returned url - * The value of $args will be urlencoded - * @return string the url - * - * Returns a url to the given app and file. - */ public function linkTo(string $appName, string $file, array $args = []): string { $frontControllerActive = ($this->config->getSystemValueBool('htaccess.IgnoreFrontController', false) || getenv('front_controller_active') === 'true'); @@ -155,16 +127,6 @@ class URLGenerator implements IURLGenerator { return $urlLinkTo; } - /** - * Creates path to an image - * - * @param string $appName app - * @param string $file image name - * @throws \RuntimeException If the image does not exist - * @return string the url - * - * Returns the path to the image. - */ public function imagePath(string $appName, string $file): string { $cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); $cacheKey = $appName.'-'.$file; @@ -243,11 +205,6 @@ class URLGenerator implements IURLGenerator { } - /** - * Makes an URL absolute - * @param string $url the url in the ownCloud host - * @return string the absolute version of the url - */ public function getAbsoluteURL(string $url): string { $separator = str_starts_with($url, '/') ? '' : '/'; @@ -262,20 +219,11 @@ class URLGenerator implements IURLGenerator { return $this->getBaseUrl() . $separator . $url; } - /** - * @param string $key - * @return string url to the online documentation - */ public function linkToDocs(string $key): string { $theme = \OC::$server->get('ThemingDefaults'); return $theme->buildDocLinkToKey($key); } - /** - * Returns the URL of the default page based on the system configuration - * and the apps visible for the current user - * @return string - */ public function linkToDefaultPageUrl(): string { // Deny the redirect if the URL contains a @ // This prevents unvalidated redirects like ?redirect_url=:user@domain.com @@ -298,9 +246,6 @@ class URLGenerator implements IURLGenerator { return $this->getAbsoluteURL('/index.php/apps/' . $appId . '/'); } - /** - * @return string base url of the current request - */ public function getBaseUrl(): string { // BaseUrl can be equal to 'http(s)://' during the first steps of the initial setup. if ($this->baseUrl === null || $this->baseUrl === 'http://' || $this->baseUrl === 'https://') { @@ -309,9 +254,6 @@ class URLGenerator implements IURLGenerator { return $this->baseUrl; } - /** - * @return string webroot part of the base url - */ public function getWebroot(): string { return \OC::$WEBROOT; } diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php index 98b291e5dee..788788cd0cb 100644 --- a/lib/private/User/Backend.php +++ b/lib/private/User/Backend.php @@ -60,46 +60,18 @@ abstract class Backend implements UserInterface { return $actions; } - /** - * Check if backend implements actions - * @param int $actions bitwise-or'ed actions - * @return boolean - * - * Returns the supported actions as int to be - * compared with self::CREATE_USER etc. - */ public function implementsActions($actions) { return (bool)($this->getSupportedActions() & $actions); } - /** - * delete a user - * @param string $uid The username of the user to delete - * @return bool - * - * Deletes a user - */ public function deleteUser($uid) { return false; } - /** - * Get a list of all users - * - * @param string $search - * @param null|int $limit - * @param null|int $offset - * @return string[] an array of all uids - */ public function getUsers($search = '', $limit = null, $offset = null) { return []; } - /** - * check if a user exists - * @param string $uid the username - * @return boolean - */ public function userExists($uid) { return false; } @@ -113,23 +85,10 @@ abstract class Backend implements UserInterface { return false; } - /** - * get display name of the user - * @param string $uid user ID of the user - * @return string display name - */ public function getDisplayName($uid) { return $uid; } - /** - * Get a list of all display names and user ids. - * - * @param string $search - * @param int|null $limit - * @param int|null $offset - * @return array an array of all displayNames (value) and the corresponding uids (key) - */ public function getDisplayNames($search = '', $limit = null, $offset = null) { $displayNames = []; $users = $this->getUsers($search, $limit, $offset); @@ -139,10 +98,6 @@ abstract class Backend implements UserInterface { return $displayNames; } - /** - * Check if a user list is available or not - * @return boolean if users can be listed or not - */ public function hasUserListings() { return false; } diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index a80cc39a732..ce03a396844 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -76,16 +76,6 @@ class Database extends ABackend implements } } - /** - * Create a new user - * - * @param string $uid The username of the user to create - * @param string $password The password of the new user - * @return bool - * - * Creates a new user. Basic checking of username is done in OC_User - * itself, not in its subclasses. - */ public function createUser(string $uid, string $password): bool { $this->fixDI(); @@ -149,15 +139,6 @@ class Database extends ABackend implements return $result ? true : false; } - /** - * Set password - * - * @param string $uid The username - * @param string $password The new password - * @return bool - * - * Change the password of a user - */ public function setPassword(string $uid, string $password): bool { $this->fixDI(); @@ -213,17 +194,6 @@ class Database extends ABackend implements return true; } - /** - * Set display name - * - * @param string $uid The username - * @param string $displayName The new display name - * @return bool - * - * @throws \InvalidArgumentException - * - * Change the display name of a user - */ public function setDisplayName(string $uid, string $displayName): bool { if (mb_strlen($displayName) > 64) { throw new \InvalidArgumentException('Invalid displayname'); @@ -246,12 +216,6 @@ class Database extends ABackend implements return false; } - /** - * get display name of the user - * - * @param string $uid user ID of the user - * @return string display name - */ public function getDisplayName($uid): string { $uid = (string)$uid; $this->loadUser($uid); @@ -298,14 +262,6 @@ class Database extends ABackend implements return $displayNames; } - /** - * @param string $searcher - * @param string $pattern - * @param int|null $limit - * @param int|null $offset - * @return array - * @since 21.0.1 - */ public function searchKnownUsersByDisplayName(string $searcher, string $pattern, ?int $limit = null, ?int $offset = null): array { $limit = $this->fixLimit($limit); @@ -338,16 +294,6 @@ class Database extends ABackend implements return $displayNames; } - /** - * Check if the password is correct - * - * @param string $loginName The loginname - * @param string $password The password - * @return string - * - * Check if the password is correct without logging in the user - * returns the user id or false - */ public function checkPassword(string $loginName, string $password) { $found = $this->loadUser($loginName); @@ -440,12 +386,6 @@ class Database extends ABackend implements return $this->cache[$uid] !== false; } - /** - * get the user's home directory - * - * @param string $uid the username - * @return string|false - */ public function getHome(string $uid) { if ($this->userExists($uid)) { return \OC::$server->getConfig()->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid; @@ -461,11 +401,6 @@ class Database extends ABackend implements return true; } - /** - * counts the users in the database - * - * @return int|false - */ public function countUsers() { $this->fixDI(); diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 9a84b102a99..1e7d7f10fe4 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -11,7 +11,6 @@ use OC\Hooks\PublicEmitter; use OC\Memcache\WithLocalCache; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; -use OCP\HintException; use OCP\ICache; use OCP\ICacheFactory; use OCP\IConfig; @@ -76,28 +75,14 @@ class Manager extends PublicEmitter implements IUserManager { $this->displayNameCache = new DisplayNameCache($cacheFactory, $this); } - /** - * Get the active backends - * @return \OCP\UserInterface[] - */ public function getBackends() { return $this->backends; } - /** - * register a user backend - * - * @param \OCP\UserInterface $backend - */ public function registerBackend($backend) { $this->backends[] = $backend; } - /** - * remove a user backend - * - * @param \OCP\UserInterface $backend - */ public function removeBackend($backend) { $this->cachedUsers = []; if (($i = array_search($backend, $this->backends)) !== false) { @@ -105,20 +90,11 @@ class Manager extends PublicEmitter implements IUserManager { } } - /** - * remove all user backends - */ public function clearBackends() { $this->cachedUsers = []; $this->backends = []; } - /** - * get a user by user id - * - * @param string $uid - * @return \OC\User\User|null Either the user or null if the specified user does not exist - */ public function get($uid) { if (is_null($uid) || $uid === '' || $uid === false) { return null; @@ -179,24 +155,11 @@ class Manager extends PublicEmitter implements IUserManager { return $user; } - /** - * check if a user exists - * - * @param string $uid - * @return bool - */ public function userExists($uid) { $user = $this->get($uid); return ($user !== null); } - /** - * Check if the password is valid for the user - * - * @param string $loginName - * @param string $password - * @return IUser|false the User object on success, false otherwise - */ public function checkPassword($loginName, $password) { $result = $this->checkPasswordNoLogging($loginName, $password); @@ -253,15 +216,6 @@ class Manager extends PublicEmitter implements IUserManager { return false; } - /** - * Search by user id - * - * @param string $pattern - * @param int $limit - * @param int $offset - * @return IUser[] - * @deprecated since 27.0.0, use searchDisplayName instead - */ public function search($pattern, $limit = null, $offset = null) { $users = []; foreach ($this->backends as $backend) { @@ -279,14 +233,6 @@ class Manager extends PublicEmitter implements IUserManager { return $users; } - /** - * Search by displayName - * - * @param string $pattern - * @param int $limit - * @param int $offset - * @return IUser[] - */ public function searchDisplayName($pattern, $limit = null, $offset = null) { $users = []; foreach ($this->backends as $backend) { @@ -304,9 +250,6 @@ class Manager extends PublicEmitter implements IUserManager { return $users; } - /** - * @return IUser[] - */ public function getDisabledUsers(?int $limit = null, int $offset = 0, string $search = ''): array { $users = $this->config->getUsersForUserValue('core', 'enabled', 'false'); $users = array_combine( @@ -342,15 +285,6 @@ class Manager extends PublicEmitter implements IUserManager { return array_slice($users, $offset, $limit); } - /** - * Search known users (from phonebook sync) by displayName - * - * @param string $searcher - * @param string $pattern - * @param int|null $limit - * @param int|null $offset - * @return IUser[] - */ public function searchKnownUsersByDisplayName(string $searcher, string $pattern, ?int $limit = null, ?int $offset = null): array { $users = []; foreach ($this->backends as $backend) { @@ -377,13 +311,6 @@ class Manager extends PublicEmitter implements IUserManager { return $users; } - /** - * @param string $uid - * @param string $password - * @return false|IUser the created user or false - * @throws \InvalidArgumentException - * @throws HintException - */ public function createUser($uid, $password) { // DI injection is not used here as IRegistry needs the user manager itself for user count and thus it would create a cyclic dependency /** @var IAssertion $assertion */ @@ -412,13 +339,6 @@ class Manager extends PublicEmitter implements IUserManager { return false; } - /** - * @param string $uid - * @param string $password - * @param UserInterface $backend - * @return IUser|false - * @throws \InvalidArgumentException - */ public function createUserFromBackend($uid, $password, UserInterface $backend) { $l = \OCP\Util::getL10N('lib'); @@ -451,13 +371,6 @@ class Manager extends PublicEmitter implements IUserManager { return false; } - /** - * returns how many users per backend exist (if supported by backend) - * - * @param boolean $hasLoggedIn when true only users that have a lastLogin - * entry in the preferences table will be affected - * @return array<string, int> an array of backend class as key and count number as value - */ public function countUsers() { $userCountStatistics = []; foreach ($this->backends as $backend) { @@ -499,16 +412,6 @@ class Manager extends PublicEmitter implements IUserManager { return count(array_unique($users)); } - /** - * The callback is executed for each user on each backend. - * If the callback returns false no further users will be retrieved. - * - * @psalm-param \Closure(\OCP\IUser):?bool $callback - * @param string $search - * @param boolean $onlySeen when true only users that have a lastLogin entry - * in the preferences table will be affected - * @since 9.0.0 - */ public function callForAllUsers(\Closure $callback, $search = '', $onlySeen = false) { if ($onlySeen) { $this->callForSeenUsers($callback); @@ -534,12 +437,6 @@ class Manager extends PublicEmitter implements IUserManager { } } - /** - * returns how many users are disabled - * - * @return int - * @since 12.0.0 - */ public function countDisabledUsers(): int { $queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $queryBuilder->select($queryBuilder->func()->count('*')) @@ -592,12 +489,6 @@ class Manager extends PublicEmitter implements IUserManager { return $count; } - /** - * returns how many users have logged in once - * - * @return int - * @since 11.0.0 - */ public function countSeenUsers() { $queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $queryBuilder->select($queryBuilder->func()->count('*')) @@ -613,11 +504,6 @@ class Manager extends PublicEmitter implements IUserManager { return $result; } - /** - * @param \Closure $callback - * @psalm-param \Closure(\OCP\IUser):?bool $callback - * @since 11.0.0 - */ public function callForSeenUsers(\Closure $callback) { $limit = 1000; $offset = 0; @@ -679,11 +565,6 @@ class Manager extends PublicEmitter implements IUserManager { return $result; } - /** - * @param string $email - * @return IUser[] - * @since 9.1.0 - */ public function getByEmail($email) { // looking for 'email' only (and not primary_mail) is intentional $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); @@ -697,12 +578,6 @@ class Manager extends PublicEmitter implements IUserManager { })); } - /** - * @param string $uid - * @param bool $checkDataDirectory - * @throws \InvalidArgumentException Message is an already translated string with a reason why the id is not valid - * @since 26.0.0 - */ public function validateUserId(string $uid, bool $checkDataDirectory = false): void { $l = Server::get(IFactory::class)->get('lib'); @@ -733,14 +608,6 @@ class Manager extends PublicEmitter implements IUserManager { } } - /** - * Gets the list of user ids sorted by lastLogin, from most recent to least recent - * - * @param int|null $limit how many users to fetch - * @param int $offset from which offset to fetch - * @param string $search search users based on search params - * @return list<string> list of user IDs - */ public function getLastLoggedInUsers(?int $limit = null, int $offset = 0, string $search = ''): array { $connection = \OC::$server->getDatabaseConnection(); $queryBuilder = $connection->getQueryBuilder(); diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 64e8f6dfdc8..0adff6f9b1c 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -138,11 +138,6 @@ class Session implements IUserSession, Emitter { $this->activeUser = null; } - /** - * set the currently active user - * - * @param IUser|null $user - */ public function setUser($user) { if (is_null($user)) { $this->session->remove('user_id'); @@ -152,20 +147,10 @@ class Session implements IUserSession, Emitter { $this->activeUser = $user; } - /** - * Temporarily set the currently active user without persisting in the session - * - * @param IUser|null $user - */ public function setVolatileActiveUser(?IUser $user): void { $this->activeUser = $user; } - /** - * get the current active user - * - * @return IUser|null Current user, otherwise null - */ public function getUser() { // FIXME: This is a quick'n dirty work-around for the incognito mode as // described at https://github.com/owncloud/core/pull/12912#issuecomment-67391155 @@ -212,11 +197,6 @@ class Session implements IUserSession, Emitter { } } - /** - * Checks whether the user is logged in - * - * @return bool if logged in - */ public function isLoggedIn() { $user = $this->getUser(); if (is_null($user)) { @@ -258,9 +238,6 @@ class Session implements IUserSession, Emitter { return null; } - /** - * @return null|string - */ public function getImpersonatingUserID(): ?string { return $this->session->get('oldUserId'); } @@ -291,14 +268,6 @@ class Session implements IUserSession, Emitter { } } - /** - * try to log in with the provided credentials - * - * @param string $uid - * @param string $password - * @return boolean|null - * @throws LoginException - */ public function login($uid, $password) { $this->session->regenerateId(); if ($this->validateToken($password, $uid)) { @@ -928,9 +897,6 @@ class Session implements IUserSession, Emitter { $this->setMagicInCookie($user->getUID(), $token); } - /** - * logout the user from the session - */ public function logout() { $user = $this->getUser(); $this->manager->emit('\OC\User', 'logout', [$user]); diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 6f7ceb08532..517c3392e66 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -19,7 +19,6 @@ use OCP\Group\Events\BeforeUserRemovedEvent; use OCP\Group\Events\UserRemovedEvent; use OCP\IAvatarManager; use OCP\IConfig; -use OCP\IImage; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserBackend; @@ -93,20 +92,10 @@ class User implements IUser { $this->dispatcher = $dispatcher; } - /** - * get the user id - * - * @return string - */ public function getUID() { return $this->uid; } - /** - * get the display name for the user, if no specific display name is set it will fallback to the user id - * - * @return string - */ public function getDisplayName() { if ($this->displayName === null) { $displayName = ''; @@ -127,15 +116,6 @@ class User implements IUser { return $this->displayName; } - /** - * set the displayname for the user - * - * @param string $displayName - * @return bool - * - * @since 25.0.0 Throw InvalidArgumentException - * @throws \InvalidArgumentException - */ public function setDisplayName($displayName) { $displayName = trim($displayName); $oldDisplayName = $this->getDisplayName(); @@ -152,16 +132,10 @@ class User implements IUser { return false; } - /** - * @inheritDoc - */ public function setEMailAddress($mailAddress) { $this->setSystemEMailAddress($mailAddress); } - /** - * @inheritDoc - */ public function setSystemEMailAddress(string $mailAddress): void { $oldMailAddress = $this->getSystemEMailAddress(); @@ -182,9 +156,6 @@ class User implements IUser { } } - /** - * @inheritDoc - */ public function setPrimaryEMailAddress(string $mailAddress): void { if ($mailAddress === '') { $this->config->deleteUserValue($this->uid, 'settings', 'primary_email'); @@ -208,12 +179,6 @@ class User implements IUser { } } - /** - * returns the timestamp of the user's last login or 0 if the user did never - * login - * - * @return int - */ public function getLastLogin() { if ($this->lastLogin === null) { $this->lastLogin = (int)$this->config->getUserValue($this->uid, 'login', 'lastLogin', 0); @@ -221,9 +186,6 @@ class User implements IUser { return (int)$this->lastLogin; } - /** - * updates the timestamp of the most recent login of this user - */ public function updateLastLoginTimestamp() { $previousLogin = $this->getLastLogin(); $now = time(); @@ -238,11 +200,6 @@ class User implements IUser { return $firstTimeLogin; } - /** - * Delete the user - * - * @return bool - */ public function delete() { if ($this->emitter) { /** @deprecated 21.0.0 use BeforeUserDeletedEvent event with the IEventDispatcher instead */ @@ -290,13 +247,6 @@ class User implements IUser { return !($result === false); } - /** - * Set the password of the user - * - * @param string $password - * @param string $recoveryPassword for the encryption app to reset encryption keys - * @return bool - */ public function setPassword($password, $recoveryPassword = null) { $this->dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($this, $password, $recoveryPassword)); if ($this->emitter) { @@ -334,11 +284,6 @@ class User implements IUser { return $this->backend->setPasswordHash($this->uid, $passwordHash); } - /** - * get the users home folder to mount - * - * @return string - */ public function getHome() { if (!$this->home) { /** @psalm-suppress UndefinedInterfaceMethod Once we get rid of the legacy implementsActions, psalm won't complain anymore */ @@ -353,11 +298,6 @@ class User implements IUser { return $this->home; } - /** - * Get the name of the backend class the user is connected with - * - * @return string - */ public function getBackendClassName() { if ($this->backend instanceof IUserBackend) { return $this->backend->getBackendName(); @@ -369,11 +309,6 @@ class User implements IUser { return $this->backend; } - /** - * Check if the backend allows the user to change his avatar on Personal page - * - * @return bool - */ public function canChangeAvatar() { if ($this->backend instanceof IProvideAvatarBackend || $this->backend->implementsActions(Backend::PROVIDE_AVATAR)) { /** @var IProvideAvatarBackend $backend */ @@ -383,20 +318,10 @@ class User implements IUser { return true; } - /** - * check if the backend supports changing passwords - * - * @return bool - */ public function canChangePassword() { return $this->backend->implementsActions(Backend::SET_PASSWORD); } - /** - * check if the backend supports changing display names - * - * @return bool - */ public function canChangeDisplayName() { if (!$this->config->getSystemValueBool('allow_user_to_change_display_name', true)) { return false; @@ -404,11 +329,6 @@ class User implements IUser { return $this->backend->implementsActions(Backend::SET_DISPLAYNAME); } - /** - * check if the user is enabled - * - * @return bool - */ public function isEnabled() { $queryDatabaseValue = function (): bool { if ($this->enabled === null) { @@ -424,11 +344,6 @@ class User implements IUser { } } - /** - * set the enabled status for the user - * - * @return void - */ public function setEnabled(bool $enabled = true) { $oldStatus = $this->isEnabled(); $setDatabaseValue = function (bool $enabled): void { @@ -453,36 +368,18 @@ class User implements IUser { } } - /** - * get the users email address - * - * @return string|null - * @since 9.0.0 - */ public function getEMailAddress() { return $this->getPrimaryEMailAddress() ?? $this->getSystemEMailAddress(); } - /** - * @inheritDoc - */ public function getSystemEMailAddress(): ?string { return $this->config->getUserValue($this->uid, 'settings', 'email', null); } - /** - * @inheritDoc - */ public function getPrimaryEMailAddress(): ?string { return $this->config->getUserValue($this->uid, 'settings', 'primary_email', null); } - /** - * get the users' quota - * - * @return string - * @since 9.0.0 - */ public function getQuota() { // allow apps to modify the user quota by hooking into the event $event = new GetQuotaEvent($this); @@ -511,14 +408,6 @@ class User implements IUser { return $quota; } - /** - * set the users' quota - * - * @param string $quota - * @return void - * @throws InvalidArgumentException - * @since 9.0.0 - */ public function setQuota($quota) { $oldQuota = $this->config->getUserValue($this->uid, 'files', 'quota', ''); if ($quota !== 'none' and $quota !== 'default') { @@ -556,13 +445,6 @@ class User implements IUser { $this->triggerChange('managers', $uids, $oldUids); } - /** - * get the avatar image if it exists - * - * @param int $size - * @return IImage|null - * @since 9.0.0 - */ public function getAvatarImage($size) { // delay the initialization if (is_null($this->avatarManager)) { @@ -578,12 +460,6 @@ class User implements IUser { return null; } - /** - * get the federation cloud id - * - * @return string - * @since 9.0.0 - */ public function getCloudId() { $uid = $this->getUID(); $server = rtrim($this->urlGenerator->getAbsoluteURL('/'), '/'); diff --git a/lib/private/UserStatus/Manager.php b/lib/private/UserStatus/Manager.php index 4658f61df82..b02b8e35005 100644 --- a/lib/private/UserStatus/Manager.php +++ b/lib/private/UserStatus/Manager.php @@ -39,9 +39,6 @@ class Manager implements IManager { $this->logger = $logger; } - /** - * @inheritDoc - */ public function getUserStatuses(array $userIds): array { $this->setupProvider(); if (!$this->provider) { |