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

AdExtensions   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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