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.
Passed
Push — master ( e02ac2...a2e6f2 )
by Toby
14:09
created

ResponseRejected   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 46
c 1
b 0
f 0
dl 0
loc 78
ccs 0
cts 17
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFieldMetaData() 0 42 1
A __construct() 0 3 1
A getFields() 0 14 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\Typeform\Events;
4
5
use BristolSU\ControlDB\Contracts\Repositories\User;
6
use BristolSU\Module\Typeform\Models\Response;
7
use BristolSU\Support\Action\Contracts\TriggerableEvent;
8
9
class ResponseRejected implements TriggerableEvent
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class ResponseRejected
Loading history...
10
{
11
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @var Response
14
     */
15
    public $response;
16
17
    public function __construct(Response $response)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
18
    {
19
        $this->response = $response;
20
    }
21
22
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
23
     * @inheritDoc
24
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
25
    public function getFields(): array
26
    {
27
        $user = app(User::class)->getById($this->response->submitted_by);
28
        return [
29
            'id' => $this->response->id,
30
            'form_id' => $this->response->form_id,
31
            'submitted_by_id' => $this->response->submitted_by,
32
            'submitted_by_email' => $user->data()->email(),
33
            'submitted_by_first_name' => $user->data()->firstName(),
34
            'submitted_by_last_name' => $user->data()->lastName(),
35
            'submitted_by_preferred_name' => $user->data()->preferredName(),
36
            'submitted_at' => $this->response->submitted_at->format('Y-m-d H:i:s'),
37
            'module_instance_id' => $this->response->module_instance_id,
38
            'activity_instance_id' => $this->response->activity_instance_id
39
        ];
40
    }
41
42
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
43
     * @inheritDoc
44
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
45
    public static function getFieldMetaData(): array
46
    {
47
        return [
48
            'id' => [
49
                'label' => 'Response ID',
50
                'helptext' => 'The ID of the response as given by Typeform'
51
            ],
52
            'form_id' => [
53
                'label' => 'Form ID',
54
                'helptext' => 'The ID of the Typeform form'
55
            ],
56
            'submitted_by_id' => [
57
                'label' => 'Form Submitted By',
58
                'helptext' => 'ID of the user who submitted the form'
59
            ],
60
            'submitted_by_email' => [
61
                'label' => 'Form Submitted By Email',
62
                'helptext' => 'Email of the user who submitted the form'
63
            ],
64
            'submitted_by_first_name' => [
65
                'label' => 'Form Submitted By First Name',
66
                'helptext' => 'First Name of the user who submitted the form'
67
            ],
68
            'submitted_by_last_name' => [
69
                'label' => 'Form Submitted By Last Name',
70
                'helptext' => 'Last Name of the user who submitted the form'
71
            ],
72
            'submitted_by_preferred_name' => [
73
                'label' => 'Form Submitted By Preferred Name',
74
                'helptext' => 'Preferred Name of the user who submitted the form'
75
            ],
76
            'submitted_at' => [
77
                'label' => 'Form Submitted At',
78
                'helptext' => 'The date and time at which the form_was_filled_in'
79
            ],
80
            'module_instance_id' => [
81
                'label' => 'Module Instance ID',
82
                'helptext' => 'ID of the module instance the form was submitted in'
83
            ],
84
            'activity_instance_id' => [
85
                'label' => 'Activity Instance ID',
86
                'helptext' => 'ID of the activity instance that submitted the form'
87
            ],
88
        ];
89
    }
90
}