Issues (16)

examples/datausage.php (1 issue)

Labels
Severity
1
<?php
2
3
require '../vendor/autoload.php';
4
5
$username = '{yourUsername}';
6
$password = '{yourPassword}';
7
$dataProviderId = '{yourDataProviderId}';
8
9
// create the API client instance
10
try {
11
    $redisConfig = [
12
        'scheme' => 'tcp',
13
        'host' => 'localhost',
14
        'port' => 6379,
15
    ];
16
    $cache = new Audiens\AdForm\Cache\RedisCache($redisConfig);
17
    $adform = new Audiens\AdForm\Client($username, $password, $cache);
18
19
} catch (Audiens\AdForm\Exception\OauthException $e) {
20
    exit($e->getMessage());
21
}
22
23
// Get data usage grouped by segment
24
$from = new DateTime('first day of this month');
25
$to = new DateTime('today');
26
$groupBy = ['segment'];
27
/** @var stdClass[] */
28
$dataUsage = $adform->dataUsage()->get($dataProviderId, $from, $to, $groupBy);
0 ignored issues
show
$dataProviderId of type string is incompatible with the type integer expected by parameter $dataProviderId of Audiens\AdForm\Manager\DataUsageManager::get(). ( Ignorable by Annotation )

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

28
$dataUsage = $adform->dataUsage()->get(/** @scrutinizer ignore-type */ $dataProviderId, $from, $to, $groupBy);
Loading history...
29
foreach ($dataUsage as $usage) {
30
    echo $usage->segmentsGroup.": ".$usage->revenue."\n";
31
}
32