Passed
Push — master ( 3cd5ab...f863cd )
by Nils
02:29
created

InventorioCloudReporter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Startwind\Inventorio\Data\Reporter;
4
5
use GuzzleHttp\Client;
6
use GuzzleHttp\RequestOptions;
7
8
class InventorioCloudReporter
9
{
10
    const COLLECT_URL = 'https://collect.inventorio.cloud/collect';
11
    private Client $client;
12
13
    public function __construct()
14
    {
15
        $this->client = new Client();
16
    }
17
18
    public function report(string $serverId, array $data)
19
    {
20
        $payload = [
21
            'server_id' => $serverId,
22
            'values' => $data
23
        ];
24
25
        var_dump($payload);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($payload) looks like debug code. Are you sure you do not want to remove it?
Loading history...
26
27
        $this->client->post(self::COLLECT_URL, [
28
            RequestOptions::JSON => $payload
29
        ]);
30
    }
31
}