Passed
Pull Request — master (#1)
by Jérémy
02:11
created
src/Model/TaskStatus.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
  */
13 13
 class TaskStatus extends Enum
14 14
 {
15
-    private const ACTIVE ='ACTIVE';
16
-    private const DONE ='DONE';
15
+    private const ACTIVE = 'ACTIVE';
16
+    private const DONE = 'DONE';
17 17
 }
Please login to merge, or discard this patch.
src/Api/Task/Task.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@
 block discarded – undo
20 20
     /**
21 21
      * @return TaskDto[]
22 22
      */
23
-    public function tasks(string $workspaceId, string $projectId, array $params = []): array
23
+    public function tasks(string $workspaceId, string $projectId, array $params = [ ]): array
24 24
     {
25
-        if (isset($params['is-active']) && !is_bool($params['is-active'])) {
25
+        if (isset($params[ 'is-active' ]) && !is_bool($params[ 'is-active' ])) {
26 26
             throw new ClockifyException('Invalid "is-active" parameter (should be a boolean value)');
27 27
         }
28 28
 
29
-        if (isset($params['name']) && empty($params['name'])) {
29
+        if (isset($params[ 'name' ]) && empty($params[ 'name' ])) {
30 30
             throw new ClockifyException('Invalid "name" parameter');
31 31
         }
32 32
 
33
-        if (isset($params['page']) && (!is_int($params['page']) || $params['page'] < 1)) {
33
+        if (isset($params[ 'page' ]) && (!is_int($params[ 'page' ]) || $params[ 'page' ] < 1)) {
34 34
             throw new ClockifyException('Invalid "page" parameter');
35 35
         }
36 36
 
37
-        if (isset($params['page-size']) && (!is_int($params['page-size']) || $params['page-size'] < 1)) {
37
+        if (isset($params[ 'page-size' ]) && (!is_int($params[ 'page-size' ]) || $params[ 'page-size' ] < 1)) {
38 38
             throw new ClockifyException('Invalid "page-size" parameter');
39 39
         }
40 40
 
Please login to merge, or discard this patch.
src/Model/TaskDto.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
     public static function fromArray(array $data): self
17 17
     {
18 18
         return new self(
19
-            $data['assigneeId'],
20
-            $data['estimate'],
21
-            $data['id'],
22
-            $data['name'],
23
-            $data['projectId'],
24
-            new TaskStatus($data['status'])
19
+            $data[ 'assigneeId' ],
20
+            $data[ 'estimate' ],
21
+            $data[ 'id' ],
22
+            $data[ 'name' ],
23
+            $data[ 'projectId' ],
24
+            new TaskStatus($data[ 'status' ])
25 25
         );
26 26
     }
27 27
 
Please login to merge, or discard this patch.
src/Model/EstimateDto.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
     public static function fromArray(array $data): self
13 13
     {
14 14
         return new self(
15
-            $data['estimate'],
16
-            new EstimateType($data['type'])
15
+            $data[ 'estimate' ],
16
+            new EstimateType($data[ 'type' ])
17 17
         );
18 18
     }
19 19
 
Please login to merge, or discard this patch.
src/Api/Project/Project.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
     /**
23 23
      * @return ProjectDtoImpl[]
24 24
      */
25
-    public function projects(string $workspaceId, array $params = []): array
25
+    public function projects(string $workspaceId, array $params = [ ]): array
26 26
     {
27
-        if (isset($params['name']) && empty($params['name'])) {
27
+        if (isset($params[ 'name' ]) && empty($params[ 'name' ])) {
28 28
             throw new ClockifyException('Invalid "name" parameter');
29 29
         }
30 30
 
31
-        if (isset($params['page']) && (!is_int($params['page']) || $params['page'] < 1)) {
31
+        if (isset($params[ 'page' ]) && (!is_int($params[ 'page' ]) || $params[ 'page' ] < 1)) {
32 32
             throw new ClockifyException('Invalid "page" parameter');
33 33
         }
34 34
 
35
-        if (isset($params['page-size']) && (!is_int($params['page-size']) || $params['page-size'] < 1)) {
35
+        if (isset($params[ 'page-size' ]) && (!is_int($params[ 'page-size' ]) || $params[ 'page-size' ] < 1)) {
36 36
             throw new ClockifyException('Invalid "page-size" parameter');
37 37
         }
38 38
 
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
         $this->apiKey = $apiKey;
33 33
     }
34 34
 
35
-    public function get(string $uri, array $params = []): array
35
+    public function get(string $uri, array $params = [ ]): array
36 36
     {
37 37
         $response = $this->http->get(
38 38
             $this->endpoint($uri, $params),
39
-            ['X-Api-Key' => $this->apiKey]
39
+            [ 'X-Api-Key' => $this->apiKey ]
40 40
         );
41 41
 
42 42
         if (200 !== $response->getStatusCode()) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             json_encode($data)
76 76
         );
77 77
 
78
-        if (!in_array($response->getStatusCode(), [200, 201], true)) {
78
+        if (!in_array($response->getStatusCode(), [ 200, 201 ], true)) {
79 79
             throw $this->createExceptionFromResponse($response);
80 80
         }
81 81
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             json_encode($data)
94 94
         );
95 95
 
96
-        if (!in_array($response->getStatusCode(), [200, 204], true)) {
96
+        if (!in_array($response->getStatusCode(), [ 200, 204 ], true)) {
97 97
             throw $this->createExceptionFromResponse($response);
98 98
         }
99 99
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         }
112 112
     }
113 113
 
114
-    private function endpoint(string $uri, array $params = []): string
114
+    private function endpoint(string $uri, array $params = [ ]): string
115 115
     {
116 116
         $endpoint = sprintf(
117 117
             '%s/%s',
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
     private function createExceptionFromResponse(ResponseInterface $response): ClockifyException
130 130
     {
131 131
         $data = json_decode((string) $response->getBody(), true);
132
-        $message = $data['message'] ?? '';
133
-        $code = $data['code'] ?? 0;
132
+        $message = $data[ 'message' ] ?? '';
133
+        $code = $data[ 'code' ] ?? 0;
134 134
 
135 135
         switch ($response->getStatusCode()) {
136 136
             case 400:
Please login to merge, or discard this patch.
src/Model/ProjectDtoImpl.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,24 +23,24 @@
 block discarded – undo
23 23
     public static function fromArray(array $data): self
24 24
     {
25 25
         return new self(
26
-            $data['archived'],
27
-            $data['billable'],
28
-            $data['clientId'],
29
-            $data['clientName'],
30
-            $data['color'],
31
-            $data['duration'],
32
-            EstimateDto::fromArray($data['estimate']),
33
-            $data['hourlyRate'] ? HourlyRateDto::fromArray($data['hourlyRate']) : null,
34
-            $data['id'],
26
+            $data[ 'archived' ],
27
+            $data[ 'billable' ],
28
+            $data[ 'clientId' ],
29
+            $data[ 'clientName' ],
30
+            $data[ 'color' ],
31
+            $data[ 'duration' ],
32
+            EstimateDto::fromArray($data[ 'estimate' ]),
33
+            $data[ 'hourlyRate' ] ? HourlyRateDto::fromArray($data[ 'hourlyRate' ]) : null,
34
+            $data[ 'id' ],
35 35
             array_map(
36 36
                 static function(array $membership): MembershipDto {
37 37
                     return MembershipDto::fromArray($membership);
38 38
                 },
39
-                $data['memberships']
39
+                $data[ 'memberships' ]
40 40
             ),
41
-            $data['name'],
42
-            $data['public'],
43
-            $data['workspaceId']
41
+            $data[ 'name' ],
42
+            $data[ 'public' ],
43
+            $data[ 'workspaceId' ]
44 44
         );
45 45
     }
46 46
 
Please login to merge, or discard this patch.
src/Model/TimeIntervalDto.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Model/TimeEntryDtoImpl.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.