UpdateDefaultTrait::updateDefault()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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
 * UpdateDefault Trait.
21
 */
22
trait UpdateDefaultTrait
23
{
24
    /**
25
     * @param array|null $params
26
     *
27
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
28
     * @throws \LogicException
29
     * @throws \InvalidArgumentException
30
     * @throws \Throwable
31
     *
32
     * @return mixed
33
     */
34 1
    public function updateDefault(array $params = [])
35
    {
36 1
        return $this->executeRequest(
37 1
            RequestMethodEnum::PUT,
38 1
            ResourceMethodEnum::UPDATE_DEFAULT,
39 1
            $params,
40 1
            null
41
        );
42
    }
43
44
    /**
45
     * @param string       $requestMethod
46
     * @param string       $requestScope
47
     * @param array        $params
48
     * @param string|array $id
49
     *
50
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
51
     * @throws \LogicException
52
     * @throws \InvalidArgumentException
53
     * @throws \Throwable
54
     *
55
     * @return mixed
56
     */
57
    abstract protected function executeRequest(
58
        string $requestMethod,
59
        string $requestScope,
60
        array $params,
61
        $id
62
    );
63
}
64