Apply fixes from StyleCI (#12117)

* Apply fixes from StyleCI

* Disable style check
This commit is contained in:
Jellyfrog
2020-09-21 14:54:51 +02:00
committed by GitHub
parent 8ec9183df5
commit 77c531527c
752 changed files with 6238 additions and 5833 deletions

View File

@@ -33,7 +33,7 @@ use Log;
class OpenTSDB extends BaseDatastore
{
/** @var \Socket\Raw\Socket $connection */
/** @var \Socket\Raw\Socket */
protected $connection;
public function __construct(\Socket\Raw\Factory $socketFactory)
@@ -76,19 +76,20 @@ class OpenTSDB extends BaseDatastore
*/
public function put($device, $measurement, $tags, $fields)
{
if (!$this->connection) {
if (! $this->connection) {
Log::error("OpenTSDB Error: not connected\n");
return;
}
$flag = Config::get('opentsdb.co');
$timestamp = Carbon::now()->timestamp;
$tmp_tags = "hostname=".$device['hostname'];
$tmp_tags = "hostname=" . $device['hostname'];
foreach ($tags as $k => $v) {
$v = str_replace(array(' ',',','='), '_', $v);
if (!empty($v)) {
$tmp_tags = $tmp_tags ." ". $k ."=".$v;
$v = str_replace([' ', ',', '='], '_', $v);
if (! empty($v)) {
$tmp_tags = $tmp_tags . " " . $k . "=" . $v;
}
}
@@ -96,10 +97,10 @@ class OpenTSDB extends BaseDatastore
foreach ($fields as $k => $v) {
$measurement = $k;
if ($flag == true) {
$measurement = $measurement.".".$device['co'];
$measurement = $measurement . "." . $device['co'];
}
$this->putData('port.'.$measurement, $timestamp, $v, $tmp_tags);
$this->putData('port.' . $measurement, $timestamp, $v, $tmp_tags);
}
} else {
if ($flag == true) {
@@ -136,7 +137,7 @@ class OpenTSDB extends BaseDatastore
/**
* Checks if the datastore wants rrdtags to be sent when issuing put()
*
* @return boolean
* @return bool
*/
public function wantsRrdTags()
{