Passed
Pull Request — master (#1)
by Jérémy
02:45 queued 52s
created

TimeEntry::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JDecool\Clockify\Api\TimeEntry;
6
7
use JDecool\Clockify\{
8
    Client,
9
    Model\TimeEntryDtoImpl
10
};
11
12
class TimeEntry
13
{
14
    private $http;
15
16
    public function __construct(Client $http)
17
    {
18
        $this->http = $http;
19
    }
20
21
    public function create(string $workspaceId, TimeEntryRequest $request): TimeEntryDtoImpl
22
    {
23
        $data = $this->http->post(" /workspaces/$workspaceId/time-entries", $request->toArray());
24
25
        return TimeEntryDtoImpl::fromArray($data);
26
    }
27
}
28