Skip to content

Commit 7f6c8ef

Browse files
author
Saket Hatwar
committed
lint
1 parent 6e52838 commit 7f6c8ef

File tree

4 files changed

+34
-19
lines changed

4 files changed

+34
-19
lines changed

modules/mri_violations/php/resolve.class.inc

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php declare(strict_types=1);
22

33
namespace LORIS\mri_violations;
4-
use \Psr\Http\Message\ServerRequestInterface;
5-
use \Psr\Http\Message\ResponseInterface;
4+
5+
use Psr\Http\Message\ServerRequestInterface;
6+
use Psr\Http\Message\ResponseInterface;
67

78
/**
89
* Implement and endpoint to handle POST requests which resolve
@@ -19,7 +20,7 @@ class Resolve extends \NDB_Page
1920
*
2021
* @return boolean true if the user is permitted to see violated scans
2122
*/
22-
function _hasAccess(\User $user) : bool
23+
function _hasAccess(\User $user): bool
2324
{
2425
return $user->hasAnyPermission(
2526
[
@@ -37,18 +38,26 @@ class Resolve extends \NDB_Page
3738
*
3839
* @return ResponseInterface
3940
*/
40-
public function handle(ServerRequestInterface $request) : ResponseInterface
41+
public function handle(ServerRequestInterface $request): ResponseInterface
4142
{
4243
$user = $request->getAttribute("user");
4344
if (!$this->_hasAccess($user)) {
44-
return new \LORIS\Http\Response\JSON\Forbidden(dgettext('loris',
45-
"Access denied"));
45+
return new \LORIS\Http\Response\JSON\Forbidden(
46+
dgettext(
47+
'loris',
48+
"Access denied"
49+
)
50+
);
4651
}
4752

4853
$requestdata = json_decode((string) $request->getBody(), true);
4954
if (!is_array($requestdata)) {
50-
return new \LORIS\Http\Response\JSON\BadRequest(dgettext('loris',
51-
"Must submit data in JSON format"));
55+
return new \LORIS\Http\Response\JSON\BadRequest(
56+
dgettext(
57+
'loris',
58+
"Must submit data in JSON format"
59+
)
60+
);
5261
}
5362

5463
$DB = $this->loris->getDatabaseConnection();
@@ -80,7 +89,7 @@ class Resolve extends \NDB_Page
8089
// Not modified
8190
$response = $response->withStatus(304);
8291
}
83-
} else if ($val !== 'unresolved') {
92+
} elseif ($val !== 'unresolved') {
8493
// no need to insert to DB for Unresolved value.
8594

8695
// Base of the insert
@@ -154,4 +163,3 @@ class Resolve extends \NDB_Page
154163
return $response;
155164
}
156165
}
157-

modules/mri_violations/php/usercentermatchornull.class.inc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class UserCenterMatchOrNull implements \LORIS\Data\Filter
2020
*
2121
* @return bool
2222
*/
23-
public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool
23+
public function filter(\User $user, \Loris\Data\DataInstance $resource): bool
2424
{
2525
// phan only understands method_exists on simple variables.
2626
// Assigning to a variable is the a workaround
@@ -37,8 +37,10 @@ class UserCenterMatchOrNull implements \LORIS\Data\Filter
3737
return true;
3838
}
3939
throw new \LorisException(
40-
dgettext('mri_violations',
41-
"Can not implement filter on a resource type that has no centers.")
40+
dgettext(
41+
'mri_violations',
42+
"Can not implement filter on a resource type that has no centers."
43+
)
4244
);
4345
}
4446
}

modules/mri_violations/php/usercentermatchornulloranypermission.class.inc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class UserCenterMatchOrNullOrAnyPermission implements \LORIS\Data\Filter
3030
*
3131
* @return bool
3232
*/
33-
public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool
33+
public function filter(\User $user, \Loris\Data\DataInstance $resource): bool
3434
{
3535
// phan only understands method_exists on simple variables.
3636
// Assigning to a variable is the a workaround
@@ -51,8 +51,10 @@ class UserCenterMatchOrNullOrAnyPermission implements \LORIS\Data\Filter
5151
return true;
5252
}
5353
throw new \LorisException(
54-
dgettext('loris',
55-
"Can not implement filter on a resource type that has no centers.")
54+
dgettext(
55+
'loris',
56+
"Can not implement filter on a resource type that has no centers."
57+
)
5658
);
5759
}
5860
}

modules/mri_violations/php/userprojectmatchornull.class.inc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
1313
* @link https://www.github.com/aces/Loris/
1414
*/
15+
1516
namespace LORIS\mri_violations;
1617

1718
/**
@@ -40,7 +41,7 @@ class UserProjectMatchOrNull implements \LORIS\Data\Filter
4041
*
4142
* @return bool true if the user has a project in common with the data
4243
*/
43-
public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool
44+
public function filter(\User $user, \Loris\Data\DataInstance $resource): bool
4445
{
4546
// phan only understands method_exists on simple variables.
4647
// Assigning to a variable is the a workaround
@@ -57,8 +58,10 @@ class UserProjectMatchOrNull implements \LORIS\Data\Filter
5758
return true;
5859
}
5960
throw new \LorisException(
60-
dgettext('loris',
61-
"Can not implement filter on a resource type that has no projects.")
61+
dgettext(
62+
'loris',
63+
"Can not implement filter on a resource type that has no projects."
64+
)
6265
);
6366
}
6467
}

0 commit comments

Comments
 (0)