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

TeamClient::getByShortName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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