Total Complexity | 9 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class TimeEntry |
||
14 | { |
||
15 | private $http; |
||
16 | |||
17 | public function __construct(Client $http) |
||
20 | } |
||
21 | |||
22 | public function create(string $workspaceId, TimeEntryRequest $request): TimeEntryDtoImpl |
||
27 | } |
||
28 | |||
29 | public function update(string $workspaceId, string $id, UpdateTimeEntryRequest $request): TimeEntryDtoImpl |
||
30 | { |
||
31 | $data = $this->http->put("/workspaces/$workspaceId/time-entries/$id", $request->toArray()); |
||
32 | |||
33 | return TimeEntryDtoImpl::fromArray($data); |
||
34 | } |
||
35 | |||
36 | public function entry(string $workspaceId, string $id, array $params = []): TimeEntryDtoImpl |
||
37 | { |
||
38 | if (isset($params['consider-duration-format']) && !is_bool($params['consider-duration-format'])) { |
||
39 | throw new ClockifyException('Invalid "consider-duration-format" parameter (should be a boolean value)'); |
||
40 | } |
||
41 | |||
42 | if (isset($params['hydrated']) && !is_bool($params['hydrated'])) { |
||
43 | throw new ClockifyException('Invalid "hydrated" parameter (should be a boolean value)'); |
||
44 | } |
||
45 | |||
46 | $data = $this->http->get("/workspaces/$workspaceId/time-entries/$id", $params); |
||
47 | |||
48 | return TimeEntryDtoImpl::fromArray($data); |
||
49 | } |
||
50 | |||
51 | public function delete(string $workspaceId, string $id): void |
||
54 | } |
||
55 | } |
||
56 |