Passed
Push — feature/fix-tests ( 289907...67712d )
by Robin
05:28 queued 13s
created

TeamClient   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 35
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A checkIfExists() 0 4 1
A create() 0 4 1
A update() 0 4 1
A join() 0 4 1
A getByShortName() 0 4 1
1
<?php
2
3
namespace Konsulting\JustGivingApiSdk\ResourceClients;
4
5
use Konsulting\JustGivingApiSdk\ResourceClients\Models\JoinTeamRequest;
6
use Konsulting\JustGivingApiSdk\ResourceClients\Models\Team;
7
8
class TeamClient extends BaseClient
9
{
10
    protected $aliases = [
11
        'getByShortName' => 'GetTeam',
12
        'checkIfExists'  => 'CheckIfTeamExists',
13
        'create'         => 'CreateTeam',
14
        'update'         => 'UpdateTeam',
15
        'join'           => 'JoinTeam',
16
    ];
17
18 1
    public function getByShortName($teamShortName)
19
    {
20 1
        return $this->get("team/" . $teamShortName);
21
    }
22
23 1
    public function checkIfExists($teamShortName)
24
    {
25 1
        return $this->head("team/" . $teamShortName);
26
    }
27
28 3
    public function create(Team $team)
29
    {
30 3
        return $this->put("team/" . $team->teamShortName, $team);
31
    }
32
33 1
    public function update($teamShortName, Team $updatedTeam)
34
    {
35 1
        return $this->post('team/' . $teamShortName, $updatedTeam);
36
    }
37
38 1
    public function join($teamShortName, JoinTeamRequest $joinTeamRequest)
39
    {
40 1
        return $this->put("team/join/" . $teamShortName, $joinTeamRequest);
41
    }
42
}
43