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
Push — master ( dba612...b06310 )
by Mario
05:16
created

EzInfoCollectionRepository::createWithValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 9
nc 1
nop 2
1
<?php
2
3
namespace Netgen\Bundle\InformationCollectionBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use eZ\Publish\API\Repository\Values\Content\Location;
7
use eZ\Publish\API\Repository\Values\User\User;
8
use Netgen\Bundle\InformationCollectionBundle\Entity\EzInfoCollection;
9
use DateTime;
10
11
class EzInfoCollectionRepository extends EntityRepository
12
{
13
    /**
14
     * Get new EzInfoCollection instance.
15
     *
16
     * @return EzInfoCollection
17
     */
18
    public function getInstance()
19
    {
20
        return new EzInfoCollection();
21
    }
22
23
    /**
24
     * Save object.
25
     *
26
     * @param EzInfoCollection $informationCollection
27
     */
28
    public function save(EzInfoCollection $informationCollection)
29
    {
30
        $this->_em->persist($informationCollection);
31
        $this->_em->flush($informationCollection);
32
    }
33
34
    /**
35
     * @param Location $location
36
     * @param User $user
37
     *
38
     * @return EzInfoCollection
39
     */
40
    public function createWithValues(Location $location, User $user)
41
    {
42
        $dt = new DateTime();
43
        $ezInfo = $this->getInstance();
44
45
        $ezInfo->setContentObjectId($location->getContentInfo()->id);
46
        $ezInfo->setUserIdentifier($user->login);
47
        $ezInfo->setCreatorId($user->id);
48
        $ezInfo->setCreated($dt->getTimestamp());
49
        $ezInfo->setModified($dt->getTimestamp());
50
51
        return $ezInfo;
52
    }
53
}
54