Passed
Pull Request — master (#4)
by
unknown
07:05
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 3 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   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $workspaceClients = array_merge($this->clients, $this->retrieveClientsForWorkspace($workspace->getId(), $this->clients));
131 131
             $workspaceProjects = array_merge($this->projects, $this->retrieveProjectsForWorkspace($workspace->getId(), $workspaceClients, $this->projects));
132 132
 
133
-            foreach($detailedReport->getData() as $timeEntry) {
133
+            foreach ($detailedReport->getData() as $timeEntry) {
134 134
                 $timeEntrySent = false;
135 135
                 $timeEntryClient = $timeEntry->getClient();
136 136
                 $timeEntryProject = $timeEntry->getProject();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 else if ($timeEntryClient === null) {
149 149
                     if ($this->useProjectsAsClients) {
150 150
                         $timeEntryClient = $timeEntryProject;
151
-                        $workspaceClients[$timeEntryProject] = $this->getInvoiceNinjaClientIdForProject($timeEntryProject);
151
+                        $workspaceClients[ $timeEntryProject ] = $this->getInvoiceNinjaClientIdForProject($timeEntryProject);
152 152
                     } else {
153 153
                         $timeEntryProject = null;
154 154
                         $this->io->warning('No client set for TimeEntry (' . $timeEntry->getDescription() . ')');
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
                 if ($timeEntryProject !== null) {
160 160
                     $this->logTask($timeEntry, $workspaceClients, $timeEntryClient, $workspaceProjects, $timeEntryProject);
161 161
 
162
-                    $this->sentTimeEntries[] = $timeEntry->getId();
162
+                    $this->sentTimeEntries[ ] = $timeEntry->getId();
163 163
                     $timeEntrySent = true;
164 164
                 } else {
165 165
                     $this->logTask($timeEntry);
166 166
 
167
-                    $this->sentTimeEntries[] = $timeEntry->getId();
167
+                    $this->sentTimeEntries[ ] = $timeEntry->getId();
168 168
                     $timeEntrySent = true;
169 169
                 }
170 170
 
171 171
                 if ($timeEntrySent) {
172
-                    $this->io->success('TimeEntry ('. $timeEntry->getDescription() . ') sent to InvoiceNinja');
172
+                    $this->io->success('TimeEntry (' . $timeEntry->getDescription() . ') sent to InvoiceNinja');
173 173
                 }
174 174
             }
175 175
         }
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
         $task->setDescription($this->buildTaskDescription($entry));
208 208
         $task->setTimeLog($this->buildTimeLog($entry));
209 209
         if (isset($clients) && isset($clientKey)) {
210
-            $task->setClientId($clients[$clientKey]);
210
+            $task->setClientId($clients[ $clientKey ]);
211 211
         }
212 212
 
213 213
         if (isset($projects) && isset($projectKey)) {
214
-            $task->setProjectId($projects[$projectKey]);
214
+            $task->setProjectId($projects[ $projectKey ]);
215 215
         }
216 216
 
217 217
         $this->invoiceNinjaClient->saveNewTask($task);
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
      */
243 243
     private function buildTimeLog(TimeEntry $entry): string
244 244
     {
245
-        $timeLog = [[
245
+        $timeLog = [ [
246 246
             $entry->getStart()->getTimestamp(),
247 247
             $entry->getEnd()->getTimestamp(),
248
-        ]];
248
+        ] ];
249 249
 
250 250
         return \GuzzleHttp\json_encode($timeLog);
251 251
     }
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
         $togglClients = $this->togglClient->getClientsForWorkspace($workspaceId);
265 265
         $invoiceNinjaClients = $this->invoiceNinjaClient->getClients();
266 266
 
267
-        $clients = [];
267
+        $clients = [ ];
268 268
 
269 269
         foreach ($togglClients as $togglClient) {
270
-            if (!isset($workspaceClients[$togglClient->getName()])) {
270
+            if (!isset($workspaceClients[ $togglClient->getName() ])) {
271 271
                 $found = false;
272 272
                 foreach ($invoiceNinjaClients as $invoiceNinjaClient) {
273 273
                     if ($invoiceNinjaClient->getIsDeleted() == false && strcasecmp($togglClient->getName(), $invoiceNinjaClient->getName()) == 0) {
274
-                        $clients[$invoiceNinjaClient->getName()] = $invoiceNinjaClient->getId();
274
+                        $clients[ $invoiceNinjaClient->getName() ] = $invoiceNinjaClient->getId();
275 275
                         $found = true;
276 276
                     }
277 277
                 }
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 
281 281
                     $client->setName($togglClient->getName());
282 282
 
283
-                    $clients[$togglClient->getName()] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
283
+                    $clients[ $togglClient->getName() ] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
284 284
 
285
-                    $this->io->success('Client ('. $togglClient->getName() . ') created in InvoiceNinja');
285
+                    $this->io->success('Client (' . $togglClient->getName() . ') created in InvoiceNinja');
286 286
                 }
287 287
             }
288 288
         }
@@ -306,14 +306,14 @@  discard block
 block discarded – undo
306 306
         $togglClients = $this->togglClient->getClientsForWorkspace($workspaceId);
307 307
         $invoiceNinjaProjects = $this->invoiceNinjaClient->getProjects();
308 308
 
309
-        $projects = [];
309
+        $projects = [ ];
310 310
 
311 311
         foreach ($togglProjects as $togglProject) {
312
-            if (!isset($workspaceProjects[$togglProject->getName()])) {
312
+            if (!isset($workspaceProjects[ $togglProject->getName() ])) {
313 313
                 $found = false;
314 314
                 foreach ($invoiceNinjaProjects as $invoiceNinjaProject) {
315 315
                     if ($invoiceNinjaProject->getIsDeleted() == false && strcasecmp($togglProject->getName(), $invoiceNinjaProject->getName()) == 0) {
316
-                        $projects[$invoiceNinjaProject->getName()] = $invoiceNinjaProject->getId();
316
+                        $projects[ $invoiceNinjaProject->getName() ] = $invoiceNinjaProject->getId();
317 317
                         $found = true;
318 318
                     }
319 319
                 }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                     if ($togglProject->getCid() !== null) {
328 328
                         foreach ($togglClients as $togglClient) {
329 329
                             if ($togglClient->getWid() == $workspaceId && $togglClient->getId() == $togglProject->getCid()) {
330
-                                $project->setClientId($workspaceClients[$togglClient->getName()]);
330
+                                $project->setClientId($workspaceClients[ $togglClient->getName() ]);
331 331
                             }
332 332
                         }
333 333
                     } else if ($this->useProjectsAsClients) {
@@ -335,20 +335,20 @@  discard block
 block discarded – undo
335 335
 
336 336
                         $client->setName($togglProject->getName());
337 337
 
338
-                        $workspaceClients[$togglProject->getName()] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
338
+                        $workspaceClients[ $togglProject->getName() ] = $this->invoiceNinjaClient->saveNewClient($client)->getId();
339 339
 
340
-                        $this->io->success('Project ('. $togglProject->getName() . ') created as Client in InvoiceNinja');
340
+                        $this->io->success('Project (' . $togglProject->getName() . ') created as Client in InvoiceNinja');
341 341
 
342
-                        $project->setClientId($workspaceClients[$togglProject->getName()]);
342
+                        $project->setClientId($workspaceClients[ $togglProject->getName() ]);
343 343
                     } else {
344
-                        $this->io->error('Client not provided for Project ('. $togglProject->getName() . ') in Toggl');
344
+                        $this->io->error('Client not provided for Project (' . $togglProject->getName() . ') in Toggl');
345 345
                         $this->io->warning("To allow using projects as clients enable 'use_projects_as_clients' in parameters config file");
346 346
                     }
347 347
 
348 348
                     if ($clientPresent) {
349
-                        $projects[$togglProject->getName()] = $this->invoiceNinjaClient->saveNewProject($project)->getId();
349
+                        $projects[ $togglProject->getName() ] = $this->invoiceNinjaClient->saveNewProject($project)->getId();
350 350
 
351
-                        $this->io->success('Project ('. $togglProject->getName() . ') created in InvoiceNinja');
351
+                        $this->io->success('Project (' . $togglProject->getName() . ') created in InvoiceNinja');
352 352
                     }
353 353
                 }
354 354
             }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      */
365 365
     private function getInvoiceNinjaClientIdForProject(string $projectName): ?string
366 366
     {
367
-        $invoiceNinjaProjects  = $this->invoiceNinjaClient->getProjects();
367
+        $invoiceNinjaProjects = $this->invoiceNinjaClient->getProjects();
368 368
         $invoiceNinjaClientId = null;
369 369
 
370 370
         foreach ($invoiceNinjaProjects as $invoiceNinjaProject) {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         $this->sentTimeEntries = unserialize(file_get_contents($this->storageDir . $this->storageFileName));
395 395
 
396 396
         if (!is_array($this->sentTimeEntries)) {
397
-            $this->sentTimeEntries = [];
397
+            $this->sentTimeEntries = [ ];
398 398
         }
399 399
 
400 400
         return $this->sentTimeEntries;
Please login to merge, or discard this patch.
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -143,9 +143,7 @@
 block discarded – undo
143 143
                 // a project is required, but a client is not.
144 144
                 if ($timeEntryProject === null) {
145 145
                     $this->io->warning('No project set for TimeEntry (' . $timeEntry->getDescription() . ')');
146
-                }
147
-
148
-                else if ($timeEntryClient === null) {
146
+                } else if ($timeEntryClient === null) {
149 147
                     if ($this->useProjectsAsClients) {
150 148
                         $timeEntryClient = $timeEntryProject;
151 149
                         $workspaceClients[$timeEntryProject] = $this->getInvoiceNinjaClientIdForProject($timeEntryProject);
Please login to merge, or discard this patch.