DownloadPreviewTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 43
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A downloadPreview() 0 9 1
executeRequest() 0 6 ?
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/wrike-php-library package.
7
 *
8
 * (c) Zbigniew Ślązak
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zibios\WrikePhpLibrary\Resource\Traits;
15
16
use Zibios\WrikePhpLibrary\Enum\Api\RequestMethodEnum;
17
use Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum;
18
19
/**
20
 * DownloadPreview Trait.
21
 */
22
trait DownloadPreviewTrait
23
{
24
    /**
25
     * @param string     $id
26
     * @param array|null $params
27
     *
28
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
29
     * @throws \LogicException
30
     * @throws \InvalidArgumentException
31
     * @throws \Throwable
32
     *
33
     * @return mixed
34
     */
35 1
    public function downloadPreview(string $id, array $params = [])
36
    {
37 1
        return $this->executeRequest(
38 1
            RequestMethodEnum::GET,
39 1
            ResourceMethodEnum::DOWNLOAD_PREVIEW,
40 1
            $params,
41 1
            $id
42
        );
43
    }
44
45
    /**
46
     * @param string       $requestMethod
47
     * @param string       $requestScope
48
     * @param array        $params
49
     * @param string|array $id
50
     *
51
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
52
     * @throws \LogicException
53
     * @throws \InvalidArgumentException
54
     * @throws \Throwable
55
     *
56
     * @return mixed
57
     */
58
    abstract protected function executeRequest(
59
        string $requestMethod,
60
        string $requestScope,
61
        array $params,
62
        $id
63
    );
64
}
65