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 ( d16b40...478306 )
by David
14:10
created

RepositoryBasedTransitionHandlerFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A createTransitionHandler() 0 16 1
A getEntityManager() 0 4 1
A getTransactionHandler() 0 4 1
1
<?php
2
3
/**
4
 * Workflow library.
5
 *
6
 * @package    workflow
7
 * @author     David Molineus <[email protected]>
8
 * @copyright  2014-2017 netzmacht David Molineus
9
 * @license    LGPL 3.0 https://github.com/netzmacht/workflow
10
 * @filesource
11
 */
12
13
declare(strict_types=1);
14
15
namespace Netzmacht\Workflow\Handler;
16
17
use Netzmacht\Workflow\Data\EntityManager;
18
use Netzmacht\Workflow\Data\StateRepository;
19
use Netzmacht\Workflow\Flow\Item;
20
use Netzmacht\Workflow\Flow\Workflow;
21
use Netzmacht\Workflow\Transaction\TransactionHandler;
22
23
/**
24
 * Class RepositoryBasedTransitionHandlerFactory creates a repository based transition handler.
25
 *
26
 * @package Netzmacht\Workflow\Factory
27
 */
28
class RepositoryBasedTransitionHandlerFactory implements TransitionHandlerFactory
29
{
30
    /**
31
     * Transaction handler being used during workflow transitions.
32
     *
33
     * @var TransactionHandler
34
     */
35
    private $transactionHandler;
36
37
    /**
38
     * The entity manager.
39
     *
40
     * @var EntityManager
41
     */
42
    private $entityManager;
43
44
    /**
45
     * Construct.
46
     *
47
     * @param EntityManager      $entityManager      The entity manager.
48
     * @param TransactionHandler $transactionHandler Transaction handler being used during workflow transitions.
49
     */
50
    public function __construct(
51
        EntityManager $entityManager,
52
        TransactionHandler $transactionHandler
53
    ) {
54
        $this->transactionHandler = $transactionHandler;
55
        $this->entityManager      = $entityManager;
56
    }
57
58
    /**
59
     * Create a transition handler.
60
     *
61
     * @param Item            $item            Workflow item.
62
     * @param Workflow        $workflow        Workflow definition.
63
     * @param string|null     $transitionName  Transition name.
64
     * @param string          $providerName    Provider name.
65
     * @param StateRepository $stateRepository The state repository.
66
     *
67
     * @return TransitionHandler
68
     */
69
    public function createTransitionHandler(
70
        Item $item,
71
        Workflow $workflow,
72
        ?string $transitionName,
73
        string $providerName,
74
        StateRepository $stateRepository
75
    ): TransitionHandler {
76
        return new RepositoryBasedTransitionHandler(
77
            $item,
78
            $workflow,
79
            $transitionName,
80
            $this->entityManager->getRepository($providerName),
81
            $stateRepository,
82
            $this->transactionHandler
83
        );
84
    }
85
86
    /**
87
     * Get the entity manager.
88
     *
89
     * @return EntityManager
90
     */
91
    public function getEntityManager(): EntityManager
92
    {
93
        return $this->entityManager;
94
    }
95
    /**
96
     * Get the transaction handler.
97
     *
98
     * @return TransactionHandler
99
     */
100
    public function getTransactionHandler(): TransactionHandler
101
    {
102
        return $this->transactionHandler;
103
    }
104
}
105