Skip to content

Commit

Permalink
Add more throws tags (#2175)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Jun 18, 2023
1 parent 7bedbc9 commit 0f6b04b
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions src/Index/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ public function get(string $setting = '', bool $includeDefaults = false)
* whichever string representation is used like 'true', '1', 'on', 'yes'.
*
* @param string $setting Setting name to return
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function getBool(string $setting): bool
{
Expand All @@ -144,6 +148,10 @@ public function getBool(string $setting): bool
*
* @param int $replicas Number of replicas
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*
* @return Response Response object
*/
public function setNumberOfReplicas(int $replicas): Response
Expand All @@ -156,6 +164,10 @@ public function setNumberOfReplicas(int $replicas): Response
*
* If no number of replicas is set, the default number is returned
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*
* @return int The number of replicas
*/
public function getNumberOfReplicas(): int
Expand All @@ -168,6 +180,10 @@ public function getNumberOfReplicas(): int
*
* If no number of shards is set, the default number is returned
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*
* @return int The number of shards
*/
public function getNumberOfShards(): int
Expand All @@ -179,43 +195,75 @@ public function getNumberOfShards(): int
* Sets the index to read only.
*
* @param bool $readOnly (default = true)
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function setReadOnly(bool $readOnly = true): Response
{
return $this->set(['blocks.read_only' => $readOnly]);
}

/**
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function getReadOnly(): bool
{
return $this->getBool('blocks.read_only');
}

/**
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function getBlocksRead(): bool
{
return $this->getBool('blocks.read');
}

/**
* @param bool $state OPTIONAL (default = true)
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function setBlocksRead(bool $state = true): Response
{
return $this->set(['blocks.read' => $state]);
}

/**
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function getBlocksWrite(): bool
{
return $this->getBool('blocks.write');
}

/**
* @param bool $state OPTIONAL (default = true)
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function setBlocksWrite(bool $state = true): Response
{
return $this->set(['blocks.write' => $state]);
}

/**
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function getBlocksMetadata(): bool
{
// When blocks.metadata is enabled, reading the settings is not possible anymore.
Expand All @@ -235,6 +283,10 @@ public function getBlocksMetadata(): bool
* Set to true to disable index metadata reads and writes.
*
* @param bool $state OPTIONAL (default = true)
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*/
public function setBlocksMetadata(bool $state = true): Response
{
Expand All @@ -249,6 +301,10 @@ public function setBlocksMetadata(bool $state = true): Response
*
* @param string $interval Duration of the refresh interval
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*
* @return Response Response object
*/
public function setRefreshInterval(string $interval): Response
Expand All @@ -261,6 +317,10 @@ public function setRefreshInterval(string $interval): Response
*
* If no interval is set, the default interval is returned
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*
* @return string Refresh interval
*/
public function getRefreshInterval(): string
Expand All @@ -276,6 +336,10 @@ public function getRefreshInterval(): string
* @param string $key Merge policy key (for ex. expunge_deletes_allowed)
* @param int|string $value
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html
*/
public function setMergePolicy(string $key, $value): Response
Expand All @@ -292,6 +356,10 @@ public function setMergePolicy(string $key, $value): Response
*
* @param string $key Merge policy key (for ex. expunge_deletes_allowed)
*
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
*
* @return int|string
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html
Expand Down

0 comments on commit 0f6b04b

Please sign in to comment.