Skip to content

Commit 1525b42

Browse files
author
Saket Hatwar
committed
lint
1 parent 6e52838 commit 1525b42

File tree

4 files changed

+37
-20
lines changed

4 files changed

+37
-20
lines changed

modules/mri_violations/php/resolve.class.inc

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace LORIS\mri_violations;
4-
use \Psr\Http\Message\ServerRequestInterface;
5-
use \Psr\Http\Message\ResponseInterface;
6+
7+
use Psr\Http\Message\ServerRequestInterface;
8+
use Psr\Http\Message\ResponseInterface;
69

710
/**
811
* Implement and endpoint to handle POST requests which resolve
@@ -19,7 +22,7 @@ class Resolve extends \NDB_Page
1922
*
2023
* @return boolean true if the user is permitted to see violated scans
2124
*/
22-
function _hasAccess(\User $user) : bool
25+
function _hasAccess(\User $user): bool
2326
{
2427
return $user->hasAnyPermission(
2528
[
@@ -37,18 +40,26 @@ class Resolve extends \NDB_Page
3740
*
3841
* @return ResponseInterface
3942
*/
40-
public function handle(ServerRequestInterface $request) : ResponseInterface
43+
public function handle(ServerRequestInterface $request): ResponseInterface
4144
{
4245
$user = $request->getAttribute("user");
4346
if (!$this->_hasAccess($user)) {
44-
return new \LORIS\Http\Response\JSON\Forbidden(dgettext('loris',
45-
"Access denied"));
47+
return new \LORIS\Http\Response\JSON\Forbidden(
48+
dgettext(
49+
'loris',
50+
"Access denied"
51+
)
52+
);
4653
}
4754

4855
$requestdata = json_decode((string) $request->getBody(), true);
4956
if (!is_array($requestdata)) {
50-
return new \LORIS\Http\Response\JSON\BadRequest(dgettext('loris',
51-
"Must submit data in JSON format"));
57+
return new \LORIS\Http\Response\JSON\BadRequest(
58+
dgettext(
59+
'loris',
60+
"Must submit data in JSON format"
61+
)
62+
);
5263
}
5364

5465
$DB = $this->loris->getDatabaseConnection();
@@ -80,7 +91,7 @@ class Resolve extends \NDB_Page
8091
// Not modified
8192
$response = $response->withStatus(304);
8293
}
83-
} else if ($val !== 'unresolved') {
94+
} elseif ($val !== 'unresolved') {
8495
// no need to insert to DB for Unresolved value.
8596

8697
// Base of the insert
@@ -154,4 +165,3 @@ class Resolve extends \NDB_Page
154165
return $response;
155166
}
156167
}
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)