Skip to content

Commit 170c3a7

Browse files
committed
phpcs
1 parent ae01a07 commit 170c3a7

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

modules/dashboard/jsx/welcome.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import DOMPurify from 'dompurify';
22

33
window.addEventListener('load', () => {
4-
fetch(loris.BaseURL + "/dashboard/projectdescription").then ( (resp) => {
4+
fetch(loris.BaseURL + '/dashboard/projectdescription').then( (resp) => {
55
if (!resp.ok) {
66
throw new Error('Could not get project description');
77
}
88
return resp.json();
9-
}).then ( (json) => {
10-
const el = document.getElementById("project-description");
9+
}).then( (json) => {
10+
const el = document.getElementById('project-description');
1111
el.innerHTML = DOMPurify.sanitize(json.Description);
1212
}).catch( (e) => console.error(e));
1313
});

modules/dashboard/php/projectdescription.class.inc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
namespace LORIS\dashboard;
3-
use \Psr\Http\Server\RequestHandlerInterface;
43
use \Psr\Http\Message\ServerRequestInterface;
54
use \Psr\Http\Message\ResponseInterface;
65

@@ -12,11 +11,28 @@ use \Psr\Http\Message\ResponseInterface;
1211

1312
class ProjectDescription extends \LORIS\Http\Endpoint
1413
{
15-
public function handle(ServerRequestInterface $request) : ResponseInterface {
14+
/**
15+
* {@inheritDoc}
16+
*
17+
* @param ServerRequestInterface $request The incoming request
18+
*
19+
* @return ResponseInterface
20+
*/
21+
public function handle(ServerRequestInterface $request) : ResponseInterface
22+
{
1623
$desc = $this->loris->getConfiguration()->getSetting('projectDescription');
1724
return new \LORIS\Http\Response\JSON\OK(['Description' => $desc]);
1825
}
19-
public function _hasAccess(\User $user) {
26+
27+
/**
28+
* The hasAccess call called by the Module class before loading the page.
29+
*
30+
* @param \User $user The user accessing the page
31+
*
32+
* @return bool
33+
*/
34+
function _hasAccess(\User $user)
35+
{
2036
return true;
2137
}
2238
}

src/Http/Endpoint.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ public function hasAccess(\User $user): bool
7070
* This function can be overridden in a module's page to load the necessary
7171
* resources to check the permissions of a user.
7272
*
73-
* @param User $user The user to load the resources for
73+
* @param \User $user The user to load the resources for
7474
* @param ServerRequestInterface $request The PSR15 Request being handled
7575
*
7676
* @return void
7777
*/
7878
public function loadResources(
79-
\User $user, ServerRequestInterface $request
79+
\User $user,
80+
ServerRequestInterface $request
8081
) : void {
8182
}
8283
}

0 commit comments

Comments
 (0)