Completed
Push — master ( e7cd46...d02ce0 )
by Zbigniew
04:25
created

UploadForFolderTrait::uploadForFolder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.6666
cc 1
eloc 6
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of the zibios/wrike-php-library package.
5
 *
6
 * (c) Zbigniew Ślązak
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zibios\WrikePhpLibrary\Resource\Traits;
13
14
use Zibios\WrikePhpLibrary\Enum\Api\RequestMethodEnum;
15
use Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum;
16
17
/**
18
 * UploadForFolder Trait.
19
 */
20
trait UploadForFolderTrait
21
{
22
    /**
23
     * @param string     $id
24
     * @param array|null $params
25
     *
26
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
27
     * @throws \LogicException
28
     * @throws \InvalidArgumentException
29
     * @throws \Exception
30
     *
31
     * @return mixed
32
     */
33 1
    public function uploadForFolder($id, array $params = [])
34
    {
35 1
        return $this->executeRequest(
36 1
            RequestMethodEnum::UPLOAD,
37 1
            ResourceMethodEnum::UPLOAD_FOR_FOLDER,
38
            $params,
39
            $id
40
        );
41
    }
42
43
    /**
44
     * @param string       $requestMethod
45
     * @param string       $requestScope
46
     * @param array        $params
47
     * @param string|array $id
48
     *
49
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
50
     * @throws \LogicException
51
     * @throws \InvalidArgumentException
52
     * @throws \Exception
53
     *
54
     * @return mixed
55
     */
56
    abstract protected function executeRequest(
57
        $requestMethod,
58
        $requestScope,
59
        array $params,
60
        $id
61
    );
62
}
63