Skip to content

Commit 67e7b3d

Browse files
committed
fix: The method validate() has a Cyclomatic Complexity of 10.
1 parent 05db493 commit 67e7b3d

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/Config/Validator/Deploy/ElasticSearchIntegrity.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,12 @@ public function validate(): Validator\ResultInterface
7979
return $this->resultFactory->success();
8080
}
8181

82+
$modules = $this->reader->read()['modules'] ?? [];
83+
$liveSearchEnabled = $modules['Magento_LiveSearchAdapter'] ?? false;
84+
8285
if ($this->magentoVersion->isGreaterOrEqual('2.4.0')
83-
&& !$this->elasticsearch->isInstalled()
86+
&& !$this->elasticsearch->isInstalled() && !$liveSearchEnabled
8487
) {
85-
$modules = $this->reader->read()['modules'] ?? [];
86-
if (isset($modules['Magento_LiveSearchAdapter']) && $modules['Magento_LiveSearchAdapter']) {
87-
return $this->resultFactory->success();
88-
}
8988
return $this->resultFactory->errorByCode(Error::DEPLOY_ES_SERVICE_NOT_INSTALLED);
9089
}
9190
} catch (UndefinedPackageException | FileSystemException $exception) {

src/Config/Validator/Deploy/OpenSearchIntegrity.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ public function validate(): Validator\ResultInterface
8686
return $this->resultFactory->errorByCode(Error::DEPLOY_MAGENTO_VERSION_DOES_NOT_SUPPORT_OS);
8787
}
8888

89+
$modules = $this->reader->read()['modules'] ?? [];
90+
$liveSearchEnabled = $modules['Magento_LiveSearchAdapter'] ?? false;
91+
8992
if ($this->magentoVersion->isGreaterOrEqual('2.4.3-p2')
90-
&& !$this->openSearch->isInstalled()
93+
&& !$this->openSearch->isInstalled() && !$liveSearchEnabled
9194
) {
92-
$modules = $this->reader->read()['modules'] ?? [];
93-
if (isset($modules['Magento_LiveSearchAdapter']) && $modules['Magento_LiveSearchAdapter']) {
94-
return $this->resultFactory->success();
95-
}
9695
return $this->resultFactory->errorByCode(Error::DEPLOY_OS_SERVICE_NOT_INSTALLED);
9796
}
9897
} catch (UndefinedPackageException | FileSystemException $exception) {

0 commit comments

Comments
 (0)