Completed
Push — master ( 0678d0...c42f85 )
by Dmitry
08:36 queued 01:17
created

Feeds   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 103
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 9 1
A delete() 0 9 1
A get() 0 14 1
A update() 0 9 1
1
<?php
2
/**
3
 * @author Dmitry Gladyshev <[email protected]>
4
 * @date 26/08/20120 21:34
5
 */
6
7
namespace Yandex\Direct\Service;
8
9
use ReflectionException;
10
use Yandex\Direct\Exception\ErrorResponseException;
11
use Yandex\Direct\Exception\Exception;
12
use Yandex\Direct\Service;
13
use function Yandex\Direct\get_param_names;
14
15
/**
16
 * Class Feeds
17
 *
18
 * Сервис предназначен для выполнения операций с фидами.
19
 *
20
 * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/feeds-docpage/
21
 */
22
final class Feeds extends Service
23
{
24
    /**
25
     * Создает фиды.
26
     *
27
     * @param array $Feeds
28
     *
29
     * @return array
30
     *
31
     * @throws ReflectionException
32
     * @throws ErrorResponseException
33
     * @throws Exception
34
     *
35
     * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/add-docpage/
36
     */
37
    public function add($Feeds)
38
    {
39
        $params = compact(get_param_names(__METHOD__));
40
41
        return $this->request([
42
            'method' => 'add',
43
            'params' => $params
44
        ]);
45
    }
46
47
    /**
48
     * Удаляет фиды.
49
     *
50
     * @param array $SelectionCriteria
51
     *
52
     * @return array
53
     *
54
     * @throws ReflectionException
55
     * @throws ErrorResponseException
56
     * @throws Exception
57
     *
58
     * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/delete-docpage/
59
     */
60
    public function delete($SelectionCriteria)
61
    {
62
        $params = compact(get_param_names(__METHOD__));
63
64
        return $this->request([
65
            'method' => 'delete',
66
            'params' => $params
67
        ]);
68
    }
69
70
    /**
71
     * Возвращает параметры фидов, отвечающих заданным критериям.
72
     *
73
     * @param array $SelectionCriteria
74
     * @param array $FieldNames
75
     * @param array $FileFeedFieldNames
76
     * @param array $UrlFeedFieldNames
77
     * @param array $Page
78
     *
79
     * @return array
80
     *
81
     * @throws ErrorResponseException
82
     * @throws Exception
83
     * @throws ReflectionException
84
     *
85
     * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/get-docpage/
86
     */
87
    public function get(
88
        $SelectionCriteria,
89
        $FieldNames,
90
        $FileFeedFieldNames = null,
91
        $UrlFeedFieldNames = null,
92
        $Page = null
93
    ) {
94
        $params = compact(get_param_names(__METHOD__));
95
96
        return $this->request([
97
            'method' => 'get',
98
            'params' => $params
99
        ]);
100
    }
101
102
    /**
103
     * Изменяет параметры фида.
104
     *
105
     * @param array $Feeds
106
     *
107
     * @return array
108
     *
109
     * @throws ErrorResponseException
110
     * @throws Exception
111
     * @throws ReflectionException
112
     *
113
     * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/update-docpage/
114
     */
115
    public function update($Feeds)
116
    {
117
        $params = compact(get_param_names(__METHOD__));
118
119
        return $this->request([
120
            'method' => 'update',
121
            'params' => $params
122
        ]);
123
    }
124
}
125