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 ( aa4ff3...5266c0 )
by Alex
22:35
created

WorkflowContext::getLoggerContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 8
rs 9.4285
c 1
b 1
f 0
cc 1
eloc 5
nc 1
nop 0
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
 *
10
 * Date: 01.09.16
11
 */
12
13
namespace Gtt\Bundle\WorkflowExtensionsBundle;
14
15
use Symfony\Component\Workflow\Workflow;
16
17
/**
18
 * Workflow context
19
 *
20
 * Data Value Object holds workflow, subject, subjectId.
21
 *
22
 * TODO: probably we need fetch subject id (using SubjectManipulator) dynamically in order to exclude
23
 * probability of diverging of real subject id with the one stored in WorkflowContext
24
 * (this can be occurred if workflow subject changes it's ID).
25
 *
26
 * @author fduch <[email protected]>
27
 */
28
class WorkflowContext
29
{
30
    /**
31
     * Workflow instance
32
     *
33
     * @var Workflow
34
     */
35
    private $workflow;
36
37
    /**
38
     * Workflow subject instance
39
     *
40
     * @var object
41
     */
42
    private $subject;
43
44
    /**
45
     * Subject id
46
     *
47
     * @var string|int
48
     */
49
    private $subjectId;
50
51
    /**
52
     * WorkflowContext constructor.
53
     *
54
     * @param Workflow   $workflow
55
     * @param object     $subject
56
     * @param string|int $subjectId
57
     */
58
    public function __construct(Workflow $workflow, $subject, $subjectId)
59
    {
60
        $this->workflow  = $workflow;
61
        $this->subject   = $subject;
62
        $this->subjectId = $subjectId;
63
    }
64
65
    /**
66
     * @return Workflow
67
     */
68
    public function getWorkflow()
69
    {
70
        return $this->workflow;
71
    }
72
73
    /**
74
     * @return object
75
     */
76
    public function getSubject()
77
    {
78
        return $this->subject;
79
    }
80
81
    /**
82
     * @return int|string
83
     */
84
    public function getSubjectId()
85
    {
86
        return $this->subjectId;
87
    }
88
89
    /**
90
     * Returns workflow logger context
91
     *
92
     * @return array
93
     */
94
    public function getLoggerContext()
95
    {
96
        return [
97
            'workflow' => $this->workflow->getName(),
98
            'class'    => get_class($this->subject),
99
            'id'       => $this->subjectId
100
        ];
101
    }
102
}
103