AdImages::add()   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 26/08/2016 13:44
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 AdImages
15
 * @package Yandex\Direct\Service
16
 */
17
final class AdImages extends Service
18
{
19
    /**
20
     * Выполняет синхронную загрузку изображений в виде бинарных данных.
21
     *
22
     * @param $AdImages
23
     * @return array
24
     * @throws Exception
25
     *
26
     * @see https://tech.yandex.ru/direct/doc/ref-v5/adimages/add-docpage/
27
     */
28
    public function add($AdImages)
29
    {
30
        return $this->request([
31
            'method' => 'add',
32
            'params' => [
33
                'AdImages' => $AdImages
34
            ]
35
        ]);
36
    }
37
38
    /**
39
     * Удаляет изображения.
40
     *
41
     * @param $SelectionCriteria
42
     * @return mixed
43
     * @throws Exception
44
     *
45
     * @see https://tech.yandex.ru/direct/doc/ref-v5/adimages/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
     * @param $SelectionCriteria
61
     * @param $FieldNames
62
     * @param $Page
63
     * @return array
64
     * @throws Exception
65
     * @throws \ReflectionException
66
     *
67
     * @see https://tech.yandex.ru/direct/doc/ref-v5/adimages/get-docpage/
68
     */
69
    public function get($SelectionCriteria, $FieldNames, $Page = null)
70
    {
71
        $params = compact(get_param_names(__METHOD__));
72
73
        return $this->request([
74
            'method' => 'get',
75
            'params' => $params
76
        ]);
77
    }
78
}
79