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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 6
dl 0
loc 43
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 4 1
A save() 0 5 1
A createWithValues() 0 13 1
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