anonymous()
last analyzed

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
nc 1
nop 1
dl 0
loc 4
c 0
b 0
f 0
1
<?php
2
require __DIR__ . '/../vendor/autoload.php';
3
4
use erjanmx\nambaone\Client;
5
use erjanmx\nambaone\ClientException;
6
7
$API_KEY = '';
8
try {
9
    $client = new Client($API_KEY);
10
11
    $client->command('user/follow', function ($user) use ($client) {
12
        $chat = $client->api->createChat($user['id']);
13
14
        $client->to($chat->data->id)->send('Welcome');
0 ignored issues
show
Bug introduced by
The method to() does not exist on erjanmx\nambaone\Client. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        $client->/** @scrutinizer ignore-call */ 
15
                 to($chat->data->id)->send('Welcome');
Loading history...
15
    });
16
17
    $client->command('message/new', function ($message) use ($client) {
18
        $client->to($message['chat_id'])->setType($message['type'])->send($message['content']);
19
    });
20
21
    $client->handleEvents();
22
} catch (ClientException $e) {
23
    //handle exception
24
}
25