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

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