Test Setup Failed
Push — master ( 3822d7...cdce76 )
by Dmitry
02:13
created

MyLogger::log()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
/**
3
 * @author Dmitry Gladyshev <[email protected]>
4
 * @created 07.11.16 12:45
5
 */
6
7
use Yandex\Direct\Client;
8
use Yandex\Direct\Credentials;
9
use Psr\Log\AbstractLogger;
10
use Yandex\Direct\Transport\JsonTransport;
11
12
/**
13
 * Simple psr-3 logger
14
 * Class MyLogger
15
 */
16
class MyLogger extends AbstractLogger
17
{
18
    public function log($level, $message, array $context = array())
19
    {
20
        echo "[$level] $message\n";
21
    }
22
}
23
24
$transport = new JsonTransport;
25
$transport->setLogger(new MyLogger);
26
27
$client = new Client(new Credentials('_LOGIN_', '_TOKEN_'), [
28
    'transport' => $transport
29
]);
30
31
$client->campaigns->get(['Ids' => [123456, 654321]], ['Status']);