for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Manticoresearch\Endpoints\Cluster;
use Manticoresearch\Endpoints\EmulateBySql;
use Manticoresearch\Endpoints\Sql;
use Manticoresearch\Exceptions\RuntimeException;
use Manticoresearch\Utils;
class Alter extends EmulateBySql
{
use Utils;
/**
* @var string
*/
protected $cluster;
public function setBody($params = null)
if (isset($this->cluster)) {
if (isset($params['operation'])) {
switch ($params['operation']) {
case 'add':
if (isset($params['index'])) {
return parent::setBody(['query' => "ALTER CLUSTER " .
$this->cluster . " ADD " . $params['index']]);
}
throw new RuntimeException('Index name is missing.');
break;
case 'drop':
$this->cluster . " DROP " . $params['index']]);
case 'update':
return parent::setBody(['query' => "ALTER CLUSTER " .$this->cluster . " UPDATE nodes"]);
break
The break statement is not necessary if it is preceded for example by a return statement:
return
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case
throw new RuntimeException('Unknown cluster operation');
throw new RuntimeException('Cluster operation is missing');
throw new RuntimeException('Cluster name is missing.');
* @return mixed
public function getCLuster()
return $this->cluster;
* @param mixed $cluster
public function setCluster($cluster)
$this->cluster = $cluster;
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.