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.

OrderSerializer::serialize()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 3
nc 4
nop 1
1
<?php
2
3
namespace App;
4
5
class OrderSerializer
6
{
7
    public function serialize(Order $order): string
8
    {
9
        $data = [
10
            'id' => $order->id(),
11
            'email' => $order->email(),
12
            'paid' => $order->paid() ? 1 : 0,
13
            'items' => [],
14
        ];
15
16
        foreach ($order->orderLines() as $orderLine) {
17
            $data['items'][] = [
18
                'id' => $orderLine->id(),
19
                'description' => $orderLine->description(),
20
                'price' => $orderLine->totalPrice(),
21
            ];
22
        }
23
24
        return json_encode($data);
25
    }
26
}
27