VCards::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

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