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.

DoctrineCargoRepository::store()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
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 - 8:18 PM
10
 */
11
declare(strict_types = 1);
12
13
namespace Codeliner\CargoBackend\Infrastructure\Persistence\Doctrine;
14
15
use Codeliner\CargoBackend\Model\Cargo\Cargo;
16
use Codeliner\CargoBackend\Model\Cargo\CargoRepositoryInterface;
17
use Codeliner\CargoBackend\Model\Cargo\TrackingId;
18
use Doctrine\ORM\EntityRepository;
19
20
final class DoctrineCargoRepository  extends EntityRepository implements CargoRepositoryInterface
21
{
22
    /**
23
     * Finds a cargo using given id.
24
     *
25
     * @param TrackingId $trackingId Id
26
     * @return Cargo if found, else null
27
     */
28
    public function get(TrackingId $trackingId)
29
    {
30
        return $this->find($trackingId);
31
    }
32
33
    /**
34
     * List all cargo.
35
     *
36
     * @return Cargo[] List of all Cargo
37
     */
38
    public function getAll(): array
39
    {
40
        return $this->findAll();
41
    }
42
43
    /**
44
     * Saves given cargo.
45
     *
46
     * @param Cargo $cargo Cargo to save
47
     */
48
    public function store(Cargo $cargo)
49
    {
50
        $this->getEntityManager()->persist($cargo);
51
        $this->getEntityManager()->flush($cargo);
52
    }
53
54
    /**
55
     * @return TrackingId A unique, generated tracking Id.
56
     */
57
    public function getNextTrackingId(): TrackingId
58
    {
59
        return TrackingId::generate();
60
    }
61
}
62