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

TimeEntry::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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