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

InventorioCloudReporter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 21
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A report() 0 11 1
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
}