GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

InvoiceService   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 5
dl 0
loc 33
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getInvoices() 0 24 4
1
<?php
2
3
namespace Speicher210\Monsum\Api\Service\Invoice;
4
5
use Speicher210\Monsum\Api\AbstractService;
6
7
/**
8
 * Service for invoices.
9
 */
10
class InvoiceService extends AbstractService
11
{
12
    /**
13
     * Get the invoices.
14
     *
15
     * @param Get\RequestData $requestData The request data.
16
     * @return Get\ApiResponse
17
     */
18 6
    public function getInvoices(Get\RequestData $requestData)
19
    {
20 6
        $request = new Get\Request($requestData);
21
22 6
        $apiResponse = $this->sendRequest($request, Get\ApiResponse::class);
23
        /** @var Get\Response $response */
24 6
        $response = $apiResponse->getResponse();
25 6
        foreach ($response->getInvoices() as $invoice) {
26 6
            $invoiceDate = $invoice->getInvoiceDate();
27 6
            if ($invoiceDate !== null) {
28 6
                $invoiceDate->setTime(0, 0, 0);
29 6
            }
30
31
            // We need to convert the due date to DateTime because of inconsistencies in the Monsum API response.
32 6
            $dueDate = $invoice->getDueDate();
33 6
            if ($dueDate !== null) {
34 6
                $dueDate = new \DateTime($dueDate);
35 6
                $dueDate->setTime(0, 0, 0);
36 6
                $invoice->setDueDate($dueDate);
37 6
            }
38 6
        }
39
40 6
        return $apiResponse;
41
    }
42
}
43