Test Failed
Pull Request — master (#4)
by
unknown
01:25
created
src/Syncer/InvoiceNinja/InvoiceNinjaClient.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,6 @@
 block discarded – undo
90 90
     }
91 91
 
92 92
     /**
93
-     * @param Project $project
94 93
      *
95 94
      * @return mixed
96 95
      */
Please login to merge, or discard this patch.
src/Syncer/Toggl/TogglClient.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     public function getWorkspaces()
51 51
     {
52 52
         $response = $this->client->request('GET', self::VERSION . '/workspaces', [
53
-            'auth' => [$this->api_key, 'api_token'],
53
+            'auth' => [ $this->api_key, 'api_token' ],
54 54
         ]);
55 55
 
56 56
         return $this->serializer->deserialize($response->getBody(), 'array<Syncer\Dto\Toggl\Workspace>', 'json');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function getClientsForWorkspace($workspaceId)
63 63
     {
64 64
         $response = $this->client->request('GET', self::VERSION . '/workspaces/' . $workspaceId . '/clients', [
65
-            'auth' => [$this->api_key, 'api_token'],
65
+            'auth' => [ $this->api_key, 'api_token' ],
66 66
         ]);
67 67
 
68 68
         return $this->serializer->deserialize($response->getBody(), 'array<Syncer\Dto\Toggl\Client>', 'json');
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public function getProjectsForWorkspace($workspaceId)
75 75
     {
76 76
         $response = $this->client->request('GET', self::VERSION . '/workspaces/' . $workspaceId . '/projects', [
77
-            'auth' => [$this->api_key, 'api_token'],
77
+            'auth' => [ $this->api_key, 'api_token' ],
78 78
         ]);
79 79
 
80 80
         return $this->serializer->deserialize($response->getBody(), 'array<Syncer\Dto\Toggl\Project>', 'json');
Please login to merge, or discard this patch.
src/Syncer/Command/SyncTimings.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use Syncer\InvoiceNinja\InvoiceNinjaClient;
10 10
 use Syncer\Toggl\ReportsClient;
11 11
 use Syncer\Toggl\TogglClient;
12
-
13 12
 use Symfony\Component\Console\Command\Command;
14 13
 use Symfony\Component\Console\Input\InputInterface;
15 14
 use Symfony\Component\Console\Output\OutputInterface;
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
         $this->togglClient = $togglClient;
97 97
         $this->reportsClient = $reportsClient;
98 98
         $this->invoiceNinjaClient = $invoiceNinjaClient;
99
-        $this->clients = $clients ?: [];
100
-        $this->projects = $projects ?: [];
99
+        $this->clients = $clients ?: [ ];
100
+        $this->projects = $projects ?: [ ];
101 101
         $this->storageDir = $storageDir;
102 102
         $this->storageFileName = $storageFileName;
103 103
         $this->useProjectsAsClients = $useProjectsAsClients ?: false;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $workspaceClients = array_merge($this->clients, $this->retrieveClientsForWorkspace($workspace->getId(), $this->clients));
139 139
             $workspaceProjects = array_merge($this->projects, $this->retrieveProjectsForWorkspace($workspace->getId(), $workspaceClients, $this->projects));
140 140
 
141
-            foreach($detailedReport->getData() as $timeEntry) {
141
+            foreach ($detailedReport->getData() as $timeEntry) {
142 142
                 $timeEntrySent = false;
143 143
                 $timeEntryClient = $timeEntry->getClient();
144 144
                 $timeEntryProject = $timeEntry->getProject();
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 } else if (!isset($timeEntryClient)) {
155 155
                     if ($this->useProjectsAsClients) {
156 156
                         $timeEntryClient = $timeEntryProject;
157
-                        $workspaceClients[$timeEntryProject] = $this->getInvoiceNinjaClientIdForProject($timeEntryProject);
157
+                        $workspaceClients[ $timeEntryProject ] = $this->getInvoiceNinjaClientIdForProject($timeEntryProject);
158 158
                     } else {
159 159
                         $timeEntryProject = NULL;
160 160
                         $this->io->warning('No client set for TimeEntry (' . $timeEntry->getDescription() . ')');
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
                 if (isset($timeEntryProject)) {
166 166
                     $this->logTask($timeEntry, $workspaceClients, $timeEntryClient, $workspaceProjects, $timeEntryProject);
167 167
 
168
-                    $sentTimeEntries[] = $timeEntry->getId();
168
+                    $sentTimeEntries[ ] = $timeEntry->getId();
169 169
                     $timeEntrySent = true;
170 170
                 } else {
171 171
                     $this->logTask($timeEntry);
172 172
 
173
-                    $sentTimeEntries[] = $timeEntry->getId();
173
+                    $sentTimeEntries[ ] = $timeEntry->getId();
174 174
                     $timeEntrySent = true;
175 175
                 }
176 176
 
177 177
                 if ($timeEntrySent) {
178
-                    $this->io->success('TimeEntry ('. $timeEntry->getDescription() . ') sent to InvoiceNinja');
178
+                    $this->io->success('TimeEntry (' . $timeEntry->getDescription() . ') sent to InvoiceNinja');
179 179
                 }
180 180
             }
181 181
         }
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
         $task->setDescription($this->buildTaskDescription($entry));
198 198
         $task->setTimeLog($this->buildTimeLog($entry));
199 199
         if (isset($clients) && isset($clientKey)) {
200
-            $task->setClientId($clients[$clientKey]);
200
+            $task->setClientId($clients[ $clientKey ]);
201 201
         }
202 202
 
203 203
         if (isset($projects) && isset($projectKey)) {
204
-            $task->setProjectId($projects[$projectKey]);
204
+            $task->setProjectId($projects[ $projectKey ]);
205 205
         }
206 206
 
207 207
         $this->invoiceNinjaClient->saveNewTask($task);
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
      */
233 233
     private function buildTimeLog(TimeEntry $entry): string
234 234
     {
235
-        $timeLog = [[
235
+        $timeLog = [ [
236 236
             $entry->getStart()->getTimestamp(),
237 237
             $entry->getEnd()->getTimestamp(),
238
-        ]];
238
+        ] ];
239 239
 
240 240
         return \GuzzleHttp\json_encode($timeLog);
241 241
     }
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
         $togglClients = $this->togglClient->getClientsForWorkspace($workspaceId);
255 255
         $invoiceNinjaClients = $this->invoiceNinjaClient->getClients();
256 256
 
257
-        $clients = [];
257
+        $clients = [ ];
258 258
 
259 259
         foreach ($togglClients as $togglClient) {
260
-            if (!isset($workspaceClients[$togglClient->getName()])) {
260
+            if (!isset($workspaceClients[ $togglClient->getName() ])) {
261 261
                 $found = false;
262 262
                 foreach ($invoiceNinjaClients as $invoiceNinjaClient) {
263 263
                     if ($invoiceNinjaClient->getIsDeleted() == false && strcasecmp($togglClient->getName(), $invoiceNinjaClient->getName()) == 0) {
264
-                        $clients[$invoiceNinjaClient->getName()] = $invoiceNinjaClient->getId();
264
+                        $clients[ $invoiceNinjaClient->getName() ] = $invoiceNinjaClient->getId();
265 265
                         $found = true;
266 266
                     }
267 267
                 }
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 
271 271
                     $client->setName($togglClient->getName());
272 272
 
273
-                    $clients[$togglClient->getName()] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
273
+                    $clients[ $togglClient->getName() ] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
274 274
 
275
-                    $this->io->success('Client ('. $togglClient->getName() . ') created in InvoiceNinja');
275
+                    $this->io->success('Client (' . $togglClient->getName() . ') created in InvoiceNinja');
276 276
                 }
277 277
             }
278 278
         }
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
         $togglClients = $this->togglClient->getClientsForWorkspace($workspaceId);
297 297
         $invoiceNinjaProjects = $this->invoiceNinjaClient->getProjects();
298 298
 
299
-        $projects = [];
299
+        $projects = [ ];
300 300
 
301 301
         foreach ($togglProjects as $togglProject) {
302
-            if (!isset($workspaceProjects[$togglProject->getName()])) {
302
+            if (!isset($workspaceProjects[ $togglProject->getName() ])) {
303 303
                 $found = false;
304 304
                 foreach ($invoiceNinjaProjects as $invoiceNinjaProject) {
305 305
                     if ($invoiceNinjaProject->getIsDeleted() == false && strcasecmp($togglProject->getName(), $invoiceNinjaProject->getName()) == 0) {
306
-                        $projects[$invoiceNinjaProject->getName()] = $invoiceNinjaProject->getId();
306
+                        $projects[ $invoiceNinjaProject->getName() ] = $invoiceNinjaProject->getId();
307 307
                         $found = true;
308 308
                     }
309 309
                 }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                     if ($togglProject->getCid() !== NULL) {
318 318
                         foreach ($togglClients as $togglClient) {
319 319
                             if ($togglClient->getWid() == $workspaceId && $togglClient->getId() == $togglProject->getCid()) {
320
-                                $project->setClientId($workspaceClients[$togglClient->getName()]);
320
+                                $project->setClientId($workspaceClients[ $togglClient->getName() ]);
321 321
                             }
322 322
                         }
323 323
                     } else if ($this->useProjectsAsClients) {
@@ -325,22 +325,22 @@  discard block
 block discarded – undo
325 325
 
326 326
                         $client->setName($togglProject->getName());
327 327
 
328
-                        $workspaceClients[$togglProject->getName()] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
328
+                        $workspaceClients[ $togglProject->getName() ] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
329 329
 
330
-                        $this->io->success('Project ('. $togglProject->getName() . ') created as Client in InvoiceNinja');
330
+                        $this->io->success('Project (' . $togglProject->getName() . ') created as Client in InvoiceNinja');
331 331
 
332
-                        $project->setClientId($workspaceClients[$togglProject->getName()]);
332
+                        $project->setClientId($workspaceClients[ $togglProject->getName() ]);
333 333
                     } else {
334 334
                         $clientPresent = false;
335 335
 
336
-                        $this->io->error('Client not provided for Project ('. $togglProject->getName() . ') in Toggl');
336
+                        $this->io->error('Client not provided for Project (' . $togglProject->getName() . ') in Toggl');
337 337
                         $this->io->warning("To allow using projects as clients enable 'use_projects_as_clients' in parameters config file");
338 338
                     }
339 339
 
340 340
                     if ($clientPresent) {
341
-                        $projects[$togglProject->getName()] = $this->invoiceNinjaClient->saveNewProject($project)->getId();
341
+                        $projects[ $togglProject->getName() ] = $this->invoiceNinjaClient->saveNewProject($project)->getId();
342 342
 
343
-                        $this->io->success('Project ('. $togglProject->getName() . ') created in InvoiceNinja');
343
+                        $this->io->success('Project (' . $togglProject->getName() . ') created in InvoiceNinja');
344 344
                     }
345 345
                 }
346 346
             }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
     private function getInvoiceNinjaClientIdForProject(string $projectName): ?int
358 358
     {
359
-        $invoiceNinjaProjects  = $this->invoiceNinjaClient->getProjects();
359
+        $invoiceNinjaProjects = $this->invoiceNinjaClient->getProjects();
360 360
         $invoiceNinjaClientId = NULL;
361 361
 
362 362
         foreach ($invoiceNinjaProjects as $invoiceNinjaProject) {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         $sentTimeEntries = unserialize(file_get_contents($this->storageDir . $this->storageFileName));
387 387
 
388 388
         if (!is_array($sentTimeEntries)) {
389
-            $sentTimeEntries = [];
389
+            $sentTimeEntries = [ ];
390 390
         }
391 391
 
392 392
         return $sentTimeEntries;
Please login to merge, or discard this patch.
src/Syncer/Toggl/ReportsClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     public function getDetailedReport(int $workspaceId, int $sinceDaysAgo)
56 56
     {
57 57
         $res = $this->client->request('GET', self::VERSION . '/details', [
58
-            'auth' => [$this->api_key, 'api_token'],
58
+            'auth' => [ $this->api_key, 'api_token' ],
59 59
             'query' => [
60 60
                 'user_agent' => '[email protected]',
61 61
                 'workspace_id' => $workspaceId,
Please login to merge, or discard this patch.