Completed
Branch v4.x (712f3d)
by Dmitry
04:56
created

VCards   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 68
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 9 1
A delete() 0 9 1
A get() 0 9 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Gladyshev\Yandex\Direct\Service;
5
6
use function Gladyshev\Yandex\Direct\get_param_names;
7
8
/**
9
 * Class VCards
10
 *
11
 * @author Dmitry Gladyshev <[email protected]>
12
 */
13
final class VCards extends \Gladyshev\Yandex\Direct\AbstractService
14
{
15
    /**
16
     * Создает виртуальные визитки.
17
     *
18
     * @param $VCards
19
     * @return array
20
     *
21
     * @throws \Throwable
22
     * @throws \Exception
23
     *
24
     * @see https://tech.yandex.ru/direct/doc/ref-v5/vcards/add-docpage/
25
     */
26
    public function add($VCards)
27
    {
28
        return $this->call([
29
            'method' => 'add',
30
            'params' => [
31
                'VCards' => $VCards
32
            ]
33
        ]);
34
    }
35
36
    /**
37
     * Удаляет виртуальные визитки.
38
     *
39
     * @param $SelectionCriteria
40
     * @return array
41
     *
42
     * @throws \Throwable
43
     *
44
     * @see https://tech.yandex.ru/direct/doc/ref-v5/vcards/delete-docpage/
45
     */
46
    public function delete($SelectionCriteria)
47
    {
48
        return $this->call([
49
            'method' => 'delete',
50
            'params' => [
51
                'SelectionCriteria' => $SelectionCriteria
52
            ]
53
        ]);
54
    }
55
56
    /**
57
     * Возвращает виртуальные визитки, отвечающие заданным критериям.
58
     *
59
     * @param $SelectionCriteria
60
     * @param $FieldNames
61
     * @param $Page
62
     * @return array
63
     *
64
     * @throws \Throwable
65
     *
66
     * @see https://tech.yandex.ru/direct/doc/ref-v5/vcards/get-docpage/
67
     */
68
    public function get($SelectionCriteria, $FieldNames, $Page = null)
69
    {
70
        $params = compact(get_param_names(__METHOD__));
71
72
        return $this->call([
73
            'method' => 'get',
74
            'params' => $params
75
        ]);
76
    }
77
}
78