Completed
Push — master ( 74bae6...8bdcbb )
by Zbigniew
03:01
created

GetAllForAccountTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 59
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 59
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllForAccount() 0 9 1
executeRequest() 0 6 ?
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
 * GetAllForAccount Trait.
19
 */
20
trait GetAllForAccountTrait
21
{
22
    /**
23
     * @param string     $id
24
     * @param array|null $params
25
     *
26
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ServerErrorException
27
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ResourceNotFoundException
28
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ParameterRequiredException
29
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\NotAuthorizedException
30
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\NotAllowedException
31
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\InvalidRequestException
32
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\InvalidParameterException
33
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
34
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\AccessForbiddenException
35
     * @throws \LogicException
36
     * @throws \InvalidArgumentException
37
     * @throws \Exception
38
     *
39
     * @return mixed
40
     */
41 20
    public function getAllForAccount($id, array $params = [])
42
    {
43 20
        return $this->executeRequest(
44 20
            RequestMethodEnum::GET,
45 20
            ResourceMethodEnum::GET_ALL_FOR_ACCOUNT,
46
            $params,
47
            $id
48
        );
49
    }
50
51
    /**
52
     * @param string       $requestMethod
53
     * @param string       $requestScope
54
     * @param array        $params
55
     * @param string|array $id
56
     *
57
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ServerErrorException
58
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ResourceNotFoundException
59
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ParameterRequiredException
60
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\NotAuthorizedException
61
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\NotAllowedException
62
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\InvalidRequestException
63
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\InvalidParameterException
64
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
65
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\AccessForbiddenException
66
     * @throws \LogicException
67
     * @throws \InvalidArgumentException
68
     * @throws \Exception
69
     *
70
     * @return mixed
71
     */
72
    abstract protected function executeRequest(
73
        $requestMethod,
74
        $requestScope,
75
        array $params,
76
        $id
77
    );
78
}
79