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.

ModuleServiceProvider::alias()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\StaticPage;
4
5
use BristolSU\Module\StaticPage\CompletionConditions\HasClickedSubmit;
6
use BristolSU\Module\StaticPage\CompletionConditions\HasViewedPage;
7
use BristolSU\Module\StaticPage\Events\ButtonSubmitted;
8
use BristolSU\Module\StaticPage\Events\ButtonUnsubmitted;
9
use BristolSU\Module\StaticPage\Events\PageViewed;
10
use BristolSU\Module\StaticPage\Models\ButtonClick;
11
use BristolSU\Module\StaticPage\VueFields\HtmlField;
12
use BristolSU\Support\Completion\Contracts\CompletionConditionManager;
13
use BristolSU\Support\Module\ModuleServiceProvider as ServiceProvider;
14
use FormSchema\Generator\Field;
15
use FormSchema\Generator\Group;
16
use FormSchema\Schema\Form;
17
use Illuminate\Database\Eloquent\ModelNotFoundException;
18
use Illuminate\Support\Facades\Route;
19
20
class ModuleServiceProvider extends ServiceProvider
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class ModuleServiceProvider
Loading history...
21
{
22
23
    protected $permissions = [
24
      'view-page' => [
25
        'name' => 'View Participant Page',
26
        'description' => 'View the main page of the module.',
27
        'admin' => false
28
      ],
29
      'click-button' => [
30
        'name' => 'Click Submit Button',
31
        'description' => 'Can click the submit button',
32
        'admin' => false
33
      ],
34
      'delete-button-click' => [
35
        'name' => 'Unsubmit Submit Button',
36
        'description' => 'Can unsubmit the page once already submitted',
37
        'admin' => false
38
      ],
39
      'admin.view-page' => [
40
        'name' => 'View Admin Page',
41
        'description' => 'View the administrator page of the module.',
42
        'admin' => true
43
      ],
44
      'admin.page-view.index' => [
45
        'name' => 'View page views',
46
        'description' => 'View all page views for the module.',
47
        'admin' => true
48
      ]
49
    ];
50
51
    protected $events = [
52
      PageViewed::class => [
53
        'name' => 'A static page has been viewed',
54
        'description' => 'A static page module has been viewed by a participant of the module.'
55
      ],
56
      ButtonSubmitted::class => [
57
        'name' => 'The button has been submitted',
58
        'description' => 'The button on a static page has been pressed by a participant'
59
      ],
60
      ButtonUnsubmitted::class => [
61
        'name' => 'The button has been unsubmitted',
62
        'description' => 'The button on a static page has been unsubmitted by a participant'
63
      ]
64
    ];
65
66
    protected $commands = [
67
68
    ];
69
70 52
    public function alias(): string
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function alias()
Loading history...
71
    {
72 52
        return 'static-page';
73
    }
74
75 52
    public function namespace()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function namespace()
Loading history...
76
    {
77 52
        return '\BristolSU\Module\StaticPage\Http\Controllers';
78
    }
79
80 52
    public function baseDirectory()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function baseDirectory()
Loading history...
81
    {
82 52
        return __DIR__ . '/..';
83
    }
84
85 52
    public function boot()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function boot()
Loading history...
86
    {
87 52
        parent::boot();
88
89 52
        $this->registerGlobalScript('modules/static-page/js/components.js');
90
91 52
        app(CompletionConditionManager::class)->register($this->alias(), 'static_page_has_viewed_page', HasViewedPage::class);
92 52
        app(CompletionConditionManager::class)->register($this->alias(), 'static_page_has_submitted', HasClickedSubmit::class);
93
94
        Route::bind('static_page_button_click', function($id) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
95 7
            $buttonClick = ButtonClick::findOrFail((int) $id);
96
            if(
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
Coding Style introduced by
First condition of a multi-line IF statement must directly follow the opening parenthesis
Loading history...
97 6
              request()->route('module_instance_slug')
0 ignored issues
show
Coding Style introduced by
Multi-line IF statement not indented correctly; expected 16 spaces but found 14
Loading history...
Coding Style introduced by
Each line in a multi-line IF statement must begin with a boolean operator
Loading history...
98 6
              && (int) $buttonClick->module_instance_id === request()->route('module_instance_slug')->id()) {
0 ignored issues
show
Coding Style introduced by
Multi-line IF statement not indented correctly; expected 16 spaces but found 14
Loading history...
Coding Style introduced by
Closing parenthesis of a multi-line IF statement must be on a new line
Loading history...
99 5
                return $buttonClick;
100
            }
101 1
            throw (new ModelNotFoundException())->setModel(ButtonClick::class, $id);
102 52
        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
103
104 52
    }
105
106 52
    public function register()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function register()
Loading history...
107
    {
108 52
        parent::register();
109 52
    }
110
111
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
112
     * @inheritDoc
113
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
114 52
    public function settings(): Form
115
    {
116 52
        return \FormSchema\Generator\Form::make()->withGroup(
117 52
          Group::make('Layout')->withField(
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 10.
Loading history...
Coding Style introduced by
Opening statement of multi-line function call not indented correctly; expected 8 spaces but found 10
Loading history...
118 52
            Field::input('title')->inputType('text')->label('Title')
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 14 spaces, but found 12.
Loading history...
119 52
              ->hint('The title of the page')->help('This will appear at the top of the page and in the browser tab.')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 16 spaces but found 14
Loading history...
120 52
          )->withField(
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 10.
Loading history...
Coding Style introduced by
Opening statement of multi-line function call not indented correctly; expected 8 spaces but found 10
Loading history...
121 52
            Field::input('subtitle')->inputType('text')->label('Subtitle')
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 14 spaces, but found 12.
Loading history...
122 52
              ->hint('The subtitle of the page')->help('This will appear below the title. You can use this to give more information about the page.')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 16 spaces but found 14
Loading history...
123 52
          )->withField(
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 10.
Loading history...
Coding Style introduced by
Opening statement of multi-line function call not indented correctly; expected 8 spaces but found 10
Loading history...
124 52
            Field::make(HtmlField::class, 'html')->label('Page Content')
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 14 spaces, but found 12.
Loading history...
125 52
              ->apiKey(config('static-page.tinymce.apiKey'))
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 16 spaces but found 14
Loading history...
126 52
              ->hint('The content of the page')->help('This is the main content of the page.')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 16 spaces but found 14
Loading history...
127
          )
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 10.
Loading history...
128 52
        )->withGroup(
129 52
          Group::make('Button')->withField(
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 10.
Loading history...
Coding Style introduced by
Opening statement of multi-line function call not indented correctly; expected 8 spaces but found 10
Loading history...
130 52
            Field::input('button_text')->inputType('text')->label('Button Text')->hint('Text to show on the button')
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 14 spaces, but found 12.
Loading history...
131
          )
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 10.
Loading history...
132 52
        )->getSchema();
133
    }
134
}
135