diff options
Diffstat (limited to 'lib/Model/ProviderIndexes.php')
-rw-r--r-- | lib/Model/ProviderIndexes.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/Model/ProviderIndexes.php b/lib/Model/ProviderIndexes.php index 2915181..3177066 100644 --- a/lib/Model/ProviderIndexes.php +++ b/lib/Model/ProviderIndexes.php @@ -27,9 +27,12 @@ namespace OCA\FullTextSearch\Model; +use OCA\FullTextSearch\Exceptions\IndexDoesNotExistException; +use OCP\FullTextSearch\Model\IIndex; + class ProviderIndexes { - /** @var Index[] */ + /** @var IIndex[] */ private $indexes; @@ -39,9 +42,9 @@ class ProviderIndexes { /** - * @return Index[] + * @return IIndex[] */ - public function getIndexes() { + public function getIndexes():array { return $this->indexes; } @@ -49,17 +52,18 @@ class ProviderIndexes { /** * @param string $documentId * - * @return null|Index + * @return IIndex + * @throws IndexDoesNotExistException */ - public function getIndex($documentId) { + public function getIndex(string $documentId): IIndex { foreach ($this->indexes as $index) { if ($index->getDocumentId() === (string)$documentId) { return $index; } } - return null; + throw new IndexDoesNotExistException(); } -}
\ No newline at end of file +} |