Passed
Pull Request — master (#1)
by Jérémy
02:45 queued 52s
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\{
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