aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/FullTextSearch/FullTextSearchManager.php
diff options
context:
space:
mode:
authorFaraz Samapoor <f.samapoor@gmail.com>2023-10-10 10:10:21 +0330
committerFaraz Samapoor <f.samapoor@gmail.com>2024-01-15 10:36:02 +0330
commit28450718541b331f6db6da92cb22dd44879f7727 (patch)
tree33e7f373505170697f1551d5b2b10edf186a59c8 /lib/private/FullTextSearch/FullTextSearchManager.php
parentc14f024fa2dae97fd716ad9f3dac958a6896f51a (diff)
downloadnextcloud-server-28450718541b331f6db6da92cb22dd44879f7727.tar.gz
nextcloud-server-28450718541b331f6db6da92cb22dd44879f7727.zip
Refactors lib/private/FullTextSearch.
Mainly using PHP8's constructor property promotion. Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com> Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Diffstat (limited to 'lib/private/FullTextSearch/FullTextSearchManager.php')
-rw-r--r--lib/private/FullTextSearch/FullTextSearchManager.php77
1 files changed, 26 insertions, 51 deletions
diff --git a/lib/private/FullTextSearch/FullTextSearchManager.php b/lib/private/FullTextSearch/FullTextSearchManager.php
index 8d850513949..acaf519209b 100644
--- a/lib/private/FullTextSearch/FullTextSearchManager.php
+++ b/lib/private/FullTextSearch/FullTextSearchManager.php
@@ -39,47 +39,35 @@ use OCP\FullTextSearch\Service\ISearchService;
* @package OC\FullTextSearch
*/
class FullTextSearchManager implements IFullTextSearchManager {
- /** @var IProviderService */
- private $providerService;
+ private ?IProviderService $providerService;
- /** @var IIndexService */
- private $indexService;
-
- /** @var ISearchService */
- private $searchService;
+ private ?IIndexService $indexService;
+ private ?ISearchService $searchService;
/**
* @since 15.0.0
- *
- * @param IProviderService $providerService
*/
- public function registerProviderService(IProviderService $providerService) {
+ public function registerProviderService(IProviderService $providerService): void {
$this->providerService = $providerService;
}
/**
* @since 15.0.0
- *
- * @param IIndexService $indexService
*/
- public function registerIndexService(IIndexService $indexService) {
+ public function registerIndexService(IIndexService $indexService): void {
$this->indexService = $indexService;
}
/**
* @since 15.0.0
- *
- * @param ISearchService $searchService
*/
- public function registerSearchService(ISearchService $searchService) {
+ public function registerSearchService(ISearchService $searchService): void {
$this->searchService = $searchService;
}
/**
* @since 16.0.0
- *
- * @return bool
*/
public function isAvailable(): bool {
if ($this->indexService === null ||
@@ -93,7 +81,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
/**
- * @return IProviderService
* @throws FullTextSearchAppNotAvailableException
*/
private function getProviderService(): IProviderService {
@@ -106,7 +93,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
/**
- * @return IIndexService
* @throws FullTextSearchAppNotAvailableException
*/
private function getIndexService(): IIndexService {
@@ -119,7 +105,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
/**
- * @return ISearchService
* @throws FullTextSearchAppNotAvailableException
*/
private function getSearchService(): ISearchService {
@@ -134,15 +119,12 @@ class FullTextSearchManager implements IFullTextSearchManager {
/**
* @throws FullTextSearchAppNotAvailableException
*/
- public function addJavascriptAPI() {
+ public function addJavascriptAPI(): void {
$this->getProviderService()->addJavascriptAPI();
}
/**
- * @param string $providerId
- *
- * @return bool
* @throws FullTextSearchAppNotAvailableException
*/
public function isProviderIndexed(string $providerId): bool {
@@ -151,9 +133,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
/**
- * @param string $providerId
- * @param string $documentId
- * @return IIndex
* @throws FullTextSearchAppNotAvailableException
*/
public function getIndex(string $providerId, string $documentId): IIndex {
@@ -161,46 +140,45 @@ class FullTextSearchManager implements IFullTextSearchManager {
}
/**
- * @param string $providerId
- * @param string $documentId
- * @param string $userId
- * @param int $status
- *
* @see IIndex for available value for $status.
*
- * @return IIndex
* @throws FullTextSearchAppNotAvailableException
*/
- public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex {
+ public function createIndex(
+ string $providerId,
+ string $documentId,
+ string $userId,
+ int $status = 0,
+ ): IIndex {
return $this->getIndexService()->createIndex($providerId, $documentId, $userId, $status);
}
/**
- * @param string $providerId
- * @param string $documentId
- * @param int $status
- * @param bool $reset
- *
* @see IIndex for available value for $status.
*
* @throws FullTextSearchAppNotAvailableException
*/
- public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false) {
+ public function updateIndexStatus(
+ string $providerId,
+ string $documentId,
+ int $status,
+ bool $reset = false,
+ ): void {
$this->getIndexService()->updateIndexStatus($providerId, $documentId, $status, $reset);
}
/**
- * @param string $providerId
- * @param array $documentIds
- * @param int $status
- * @param bool $reset
- *
* @see IIndex for available value for $status.
*
* @throws FullTextSearchAppNotAvailableException
*/
- public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false) {
+ public function updateIndexesStatus(
+ string $providerId,
+ array $documentIds,
+ int $status,
+ bool $reset = false,
+ ): void {
$this->getIndexService()->updateIndexesStatus($providerId, $documentIds, $status, $reset);
}
@@ -210,15 +188,12 @@ class FullTextSearchManager implements IFullTextSearchManager {
*
* @throws FullTextSearchAppNotAvailableException
*/
- public function updateIndexes(array $indexes) {
+ public function updateIndexes(array $indexes): void {
$this->getIndexService()->updateIndexes($indexes);
}
/**
- * @param array $request
- * @param string $userId
- *
* @return ISearchResult[]
* @throws FullTextSearchAppNotAvailableException
*/