@@ -15,9 +15,9 @@ |
||
| 15 | 15 | public static function fromArray(array $data): self |
| 16 | 16 | { |
| 17 | 17 | return new self( |
| 18 | - new DateTimeImmutable($data['start']), |
|
| 19 | - new DateTimeImmutable($data['end']), |
|
| 20 | - $data['duration'] |
|
| 18 | + new DateTimeImmutable($data[ 'start' ]), |
|
| 19 | + new DateTimeImmutable($data[ 'end' ]), |
|
| 20 | + $data[ 'duration' ] |
|
| 21 | 21 | ); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -20,16 +20,16 @@ |
||
| 20 | 20 | public static function fromArray(array $data): self |
| 21 | 21 | { |
| 22 | 22 | return new self( |
| 23 | - $data['billable'], |
|
| 24 | - $data['description'], |
|
| 25 | - $data['id'], |
|
| 26 | - $data['isLocked'], |
|
| 27 | - $data['projectId'], |
|
| 28 | - $data['tagIds'], |
|
| 29 | - $data['taskId'], |
|
| 30 | - TimeIntervalDto::fromArray($data['timeInterval']), |
|
| 31 | - $data['userId'], |
|
| 32 | - $data['workspaceId'] |
|
| 23 | + $data[ 'billable' ], |
|
| 24 | + $data[ 'description' ], |
|
| 25 | + $data[ 'id' ], |
|
| 26 | + $data[ 'isLocked' ], |
|
| 27 | + $data[ 'projectId' ], |
|
| 28 | + $data[ 'tagIds' ], |
|
| 29 | + $data[ 'taskId' ], |
|
| 30 | + TimeIntervalDto::fromArray($data[ 'timeInterval' ]), |
|
| 31 | + $data[ 'userId' ], |
|
| 32 | + $data[ 'workspaceId' ] |
|
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | return TimeEntryDtoImpl::fromArray($data); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function entry(string $workspaceId, string $id, array $params = []): TimeEntryDtoImpl |
|
| 43 | + public function entry(string $workspaceId, string $id, array $params = [ ]): TimeEntryDtoImpl |
|
| 44 | 44 | { |
| 45 | - if (isset($params['consider-duration-format']) && !is_bool($params['consider-duration-format'])) { |
|
| 45 | + if (isset($params[ 'consider-duration-format' ]) && !is_bool($params[ 'consider-duration-format' ])) { |
|
| 46 | 46 | throw new ClockifyException('Invalid "consider-duration-format" parameter (should be a boolean value)'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (isset($params['hydrated']) && !is_bool($params['hydrated'])) { |
|
| 49 | + if (isset($params[ 'hydrated' ]) && !is_bool($params[ 'hydrated' ])) { |
|
| 50 | 50 | throw new ClockifyException('Invalid "hydrated" parameter (should be a boolean value)'); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -67,57 +67,57 @@ discard block |
||
| 67 | 67 | return TimeEntryDtoImpl::fromArray($data); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function find(string $workspaceId, string $userId, array $params = []): array |
|
| 70 | + public function find(string $workspaceId, string $userId, array $params = [ ]): array |
|
| 71 | 71 | { |
| 72 | - if (isset($params['description']) && !is_string($params['description'])) { |
|
| 72 | + if (isset($params[ 'description' ]) && !is_string($params[ 'description' ])) { |
|
| 73 | 73 | throw new ClockifyException('Invalid "description" parameter'); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (isset($params['start']) && !is_string($params['start'])) { |
|
| 76 | + if (isset($params[ 'start' ]) && !is_string($params[ 'start' ])) { |
|
| 77 | 77 | throw new ClockifyException('Invalid "start" parameter'); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (isset($params['end']) && !is_string($params['end'])) { |
|
| 80 | + if (isset($params[ 'end' ]) && !is_string($params[ 'end' ])) { |
|
| 81 | 81 | throw new ClockifyException('Invalid "end" parameter'); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (isset($params['project']) && !is_string($params['project'])) { |
|
| 84 | + if (isset($params[ 'project' ]) && !is_string($params[ 'project' ])) { |
|
| 85 | 85 | throw new ClockifyException('Invalid "project" parameter'); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if (isset($params['task']) && !is_string($params['task'])) { |
|
| 88 | + if (isset($params[ 'task' ]) && !is_string($params[ 'task' ])) { |
|
| 89 | 89 | throw new ClockifyException('Invalid "task" parameter'); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if (isset($params['tags']) && !is_array($params['tags'])) { |
|
| 92 | + if (isset($params[ 'tags' ]) && !is_array($params[ 'tags' ])) { |
|
| 93 | 93 | throw new ClockifyException('Invalid "tags" parameter'); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if (isset($params['project-required']) && !is_bool($params['project-required'])) { |
|
| 96 | + if (isset($params[ 'project-required' ]) && !is_bool($params[ 'project-required' ])) { |
|
| 97 | 97 | throw new ClockifyException('Invalid "project-required" parameter'); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if (isset($params['task-required']) && !is_bool($params['task-required'])) { |
|
| 100 | + if (isset($params[ 'task-required' ]) && !is_bool($params[ 'task-required' ])) { |
|
| 101 | 101 | throw new ClockifyException('Invalid "task-required" parameter'); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if (isset($params['consider-duration-format']) && !is_bool($params['consider-duration-format'])) { |
|
| 104 | + if (isset($params[ 'consider-duration-format' ]) && !is_bool($params[ 'consider-duration-format' ])) { |
|
| 105 | 105 | throw new ClockifyException('Invalid "consider-duration-format" parameter'); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (isset($params['hydrated']) && !is_bool($params['hydrated'])) { |
|
| 108 | + if (isset($params[ 'hydrated' ]) && !is_bool($params[ 'hydrated' ])) { |
|
| 109 | 109 | throw new ClockifyException('Invalid "hydrated" parameter'); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (isset($params['in-progress']) && !is_bool($params['in-progress'])) { |
|
| 112 | + if (isset($params[ 'in-progress' ]) && !is_bool($params[ 'in-progress' ])) { |
|
| 113 | 113 | throw new ClockifyException('Invalid "in-progress" parameter'); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if (isset($params['page']) && (!is_int($params['page']) || $params['page'] < 1)) { |
|
| 116 | + if (isset($params[ 'page' ]) && (!is_int($params[ 'page' ]) || $params[ 'page' ] < 1)) { |
|
| 117 | 117 | throw new ClockifyException('Invalid "page" parameter'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (isset($params['page-size']) && (!is_int($params['page-size']) || $params['page-size'] < 1)) { |
|
| 120 | + if (isset($params[ 'page-size' ]) && (!is_int($params[ 'page-size' ]) || $params[ 'page-size' ] < 1)) { |
|
| 121 | 121 | throw new ClockifyException('Invalid "page-size" parameter'); |
| 122 | 122 | } |
| 123 | 123 | |