Passed
Pull Request — master (#1)
by Jérémy
01:49
created

TimeEntry   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 14
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JDecool\Clockify\Api\TimeEntry;
6
7
use JDecool\Clockify\Client;
8
use JDecool\Clockify\Model\TimeEntryDtoImpl;
9
10
class TimeEntry
11
{
12
    private $http;
13
14
    public function __construct(Client $http)
15
    {
16
        $this->http = $http;
17
    }
18
19
    public function create(string $workspaceId, TimeEntryRequest $request): TimeEntryDtoImpl
20
    {
21
        $data = $this->http->post(" /workspaces/$workspaceId/time-entries", $request->toArray());
22
23
        return TimeEntryDtoImpl::fromArray($data);
24
    }
25
}
26