Keywords::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:34
5
 */
6
7
namespace Yandex\Direct\Service;
8
9
use Yandex\Direct\Exception\Exception;
10
use Yandex\Direct\Service;
11
use function Yandex\Direct\get_param_names;
12
13
/**
14
 * Class Keywords
15
 * @package Yandex\Direct\Service
16
 */
17
final class Keywords extends Service
18
{
19
    /**
20
     * Создает ключевые фразы.
21
     *
22
     * @param array $Keywords
23
     * @return array
24
     * @throws Exception
25
     *
26
     * @see https://tech.yandex.ru/direct/doc/ref-v5/keywords/add-docpage/
27
     */
28
    public function add($Keywords)
29
    {
30
        return $this->request([
31
            'method' => 'add',
32
            'params' => [
33
                'Keywords' => $Keywords
34
            ]
35
        ]);
36
    }
37
38
    /**
39
     * Удаляет ключевые фразы.
40
     *
41
     * @param array $SelectionCriteria
42
     * @return array
43
     * @throws Exception
44
     *
45
     * @see https://tech.yandex.ru/direct/doc/ref-v5/keywords/delete-docpage/
46
     */
47
    public function delete($SelectionCriteria)
48
    {
49
        return $this->request([
50
            'method' => 'delete',
51
            'params' => [
52
                'SelectionCriteria' => $SelectionCriteria
53
            ]
54
        ]);
55
    }
56
57
    /**
58
     * Возвращает параметры ключевых фраз, отвечающих заданным критериям: значения подстановочных переменных,
59
     * статус и состояние, продуктивность, статистику показов и кликов, ставки и приоритеты.
60
     *
61
     * @param array $SelectionCriteria
62
     * @param array $FieldNames
63
     * @param array $Page
64
     * @return array
65
     * @throws Exception
66
     * @throws \ReflectionException
67
     *
68
     * @see https://tech.yandex.ru/direct/doc/ref-v5/keywords/get-docpage/
69
     */
70
    public function get($SelectionCriteria, $FieldNames, $Page = null)
71
    {
72
        $params = compact(get_param_names(__METHOD__));
73
74
        return $this->request([
75
            'method' => 'get',
76
            'params' => $params
77
        ]);
78
    }
79
80
    /**
81
     * Возобновляет показы по ранее остановленным ключевым фразам.
82
     *
83
     * @param array $SelectionCriteria
84
     * @return array
85
     * @throws Exception
86
     * @see https://tech.yandex.ru/direct/doc/ref-v5/keywords/resume-docpage/
87
     */
88
    public function resume($SelectionCriteria)
89
    {
90
        return $this->request([
91
            'method' => 'resume',
92
            'params' => [
93
                'SelectionCriteria' => $SelectionCriteria
94
            ]
95
        ]);
96
    }
97
98
    /**
99
     * Останавливает показы по ключевым фразам.
100
     *
101
     * @param array $SelectionCriteria
102
     * @return array
103
     * @throws Exception
104
     *
105
     * @see https://tech.yandex.ru/direct/doc/ref-v5/keywords/suspend-docpage/
106
     */
107
    public function suspend($SelectionCriteria)
108
    {
109
        return $this->request([
110
            'method' => 'suspend',
111
            'params' => [
112
                'SelectionCriteria' => $SelectionCriteria
113
            ]
114
        ]);
115
    }
116
117
    /**
118
     * Изменяет параметры фраз.
119
     *
120
     * @param array $Keywords
121
     * @return array
122
     * @throws Exception
123
     *
124
     * @see https://tech.yandex.ru/direct/doc/ref-v5/keywords/update-docpage/
125
     */
126
    public function update($Keywords)
127
    {
128
        return $this->request([
129
            'method' => 'update',
130
            'params' => [
131
                'Keywords' => $Keywords
132
            ]
133
        ]);
134
    }
135
}
136