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.

OrmPersistentMarkingStore   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 51
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getMarking() 0 4 1
A setMarking() 0 9 1
1
<?php
2
/**
3
 * This file is part of the Global Trading Technologies Ltd workflow-extension-bundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * (c) fduch <[email protected]>
9
 * @date 02.08.16
10
 */
11
12
namespace Gtt\Bundle\WorkflowExtensionsBundle\MarkingStore;
13
14
use Doctrine\Bundle\DoctrineBundle\Registry;
15
use Symfony\Component\Workflow\Marking;
16
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
17
18
/**
19
 * Decorates original marking store with ORM persisting feature during mutating the subject marking
20
 */
21
class OrmPersistentMarkingStore implements MarkingStoreInterface
22
{
23
    /**
24
     * Origin marking store
25
     *
26
     * @var MarkingStoreInterface
27
     */
28
    private $originMarkingStore;
29
30
    /**
31
     * Doctrine registry
32
     *
33
     * @var Registry
34
     */
35
    private $doctrineRegistry;
36
37
    /**
38
     * OrmPersistentMarkingStore constructor.
39
     *
40
     * @param MarkingStoreInterface $originMarkingStore origin marking store
41
     * @param Registry              $doctrineRegistry   doctrine registry
42
     */
43
    public function __construct(MarkingStoreInterface $originMarkingStore, Registry $doctrineRegistry)
44
    {
45
        $this->doctrineRegistry   = $doctrineRegistry;
46
        $this->originMarkingStore = $originMarkingStore;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getMarking($subject)
53
    {
54
        return $this->originMarkingStore->getMarking($subject);
55
    }
56
57
    /**
58
     * Updates subject's marking and persists it using ORM
59
     *
60
     * {@inheritdoc}
61
     */
62
    public function setMarking($subject, Marking $marking)
63
    {
64
        $this->originMarkingStore->setMarking($subject, $marking);
65
66
        $manager = $this->doctrineRegistry->getManagerForClass(get_class($subject));
67
        // for DEFERRED_EXPLICIT change tracking policies we also persisting subject here
68
        $manager->persist($subject);
69
        $manager->flush();
70
    }
71
}