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.
Completed
Pull Request — master (#29)
by Daniel
12:02 queued 09:43
created

CreateCargo::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 6
nc 1
nop 2
1
<?php
2
/*
3
 * This file is part of the prooph/cargo-sample2.
4
 * (c) Alexander Miertsch <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 * 
9
 * Date: 06.12.2015 - 10:35 PM
10
 */
11
namespace Codeliner\CargoBackend\Http\Action;
12
13
use Assert\Assertion;
14
use Codeliner\CargoBackend\Application\Booking\BookingService;
15
use Psr\Http\Message\ResponseInterface;
16
use Psr\Http\Message\ServerRequestInterface;
17
use Zend\Diactoros\Response\JsonResponse;
18
19
/**
20
 * Class CreateCargo
21
 *
22
 * @package Codeliner\CargoBackend\Application\Action
23
 */
24
final class CreateCargo
25
{
26
    /**
27
     * @var BookingService
28
     */
29
    private $bookingService;
30
31
    /**
32
     * CreateCargo constructor.
33
     *
34
     * @param BookingService $bookingService
35
     */
36
    public function __construct(BookingService $bookingService)
37
    {
38
        $this->bookingService = $bookingService;
39
    }
40
41
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        $data = $request->getParsedBody();
44
45
        Assertion::keyExists($data, 'origin');
46
        Assertion::keyExists($data, 'destination');
47
48
        $trackingId = $this->bookingService->bookNewCargo($data['origin'], $data['destination']);
49
50
        return new JsonResponse(['trackingId' => $trackingId]);
51
    }
52
}
53