Skip to content

Commit dbd6f5c

Browse files
committed
refator: remove code that loads setting helper
1 parent d2ea9d3 commit dbd6f5c

File tree

14 files changed

+3
-41
lines changed

14 files changed

+3
-41
lines changed

src/Authentication/Authenticators/Session.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ class Session implements AuthenticatorInterface
7373

7474
public function __construct(UserModel $provider)
7575
{
76-
helper('setting');
77-
7876
$this->provider = $provider;
7977

8078
$this->loginModel = model(LoginModel::class);

src/Authorization/Groups.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
*/
1414
class Groups
1515
{
16-
public function __construct()
17-
{
18-
if (! function_exists('setting')) {
19-
helper('setting');
20-
}
21-
}
22-
2316
/**
2417
* Grabs a group info from settings.
2518
*/

src/Authorization/Traits/Authorizable.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,7 @@ public function can(string ...$permissions): bool
259259
return false;
260260
}
261261

262-
$matrix = function_exists('setting')
263-
? setting('AuthGroups.matrix')
264-
: config('AuthGroups')->matrix;
262+
$matrix = setting('AuthGroups.matrix');
265263

266264
foreach ($this->groupCache as $group) {
267265
// Check exact match
@@ -396,18 +394,14 @@ private function saveGroupsOrPermissions(string $type, $model, array $cache): vo
396394
*/
397395
private function getConfigGroups(): array
398396
{
399-
return function_exists('setting')
400-
? array_keys(setting('AuthGroups.groups'))
401-
: array_keys(config('AuthGroups')->groups);
397+
return array_keys(setting('AuthGroups.groups'));
402398
}
403399

404400
/**
405401
* @return string[]
406402
*/
407403
private function getConfigPermissions(): array
408404
{
409-
return function_exists('setting')
410-
? array_keys(setting('AuthGroups.permissions'))
411-
: array_keys(config('AuthGroups')->permissions);
405+
return array_keys(setting('AuthGroups.permissions'));
412406
}
413407
}

src/Controllers/ActionController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
class ActionController extends BaseController
1919
{
2020
protected ?ActionInterface $action = null;
21-
protected $helpers = ['setting'];
2221

2322
/**
2423
* Perform an initial check if we have a valid action or not.

src/Controllers/LoginController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ class LoginController extends BaseController
1414
{
1515
use Viewable;
1616

17-
protected $helpers = ['setting'];
18-
1917
/**
2018
* Displays the form the login to the site.
2119
*

src/Controllers/MagicLinkController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class MagicLinkController extends BaseController
3434

3535
public function __construct()
3636
{
37-
helper('setting');
38-
3937
/** @var class-string<UserModel> $providerClass */
4038
$providerClass = setting('Auth.userProvider');
4139

src/Controllers/RegisterController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class RegisterController extends BaseController
2727
{
2828
use Viewable;
2929

30-
protected $helpers = ['setting'];
31-
3230
public function initController(
3331
RequestInterface $request,
3432
ResponseInterface $response,

src/Filters/ForcePasswordResetFilter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ public function before(RequestInterface $request, $arguments = null)
3232
return;
3333
}
3434

35-
helper('setting');
36-
3735
/** @var Session $authenticator */
3836
$authenticator = auth('session')->getAuthenticator();
3937

src/Filters/HmacAuth.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public function before(RequestInterface $request, $arguments = null)
2323
{
2424
$authenticator = auth('hmac')->getAuthenticator();
2525

26-
helper('setting');
27-
2826
$requestParams = [
2927
'token' => $request->getHeaderLine(setting('Auth.authenticatorHeader')['hmac'] ?? 'Authorization'),
3028
'body' => $request->getBody() ?? '',

src/Filters/JWTAuth.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public function before(RequestInterface $request, $arguments = null)
3333
return;
3434
}
3535

36-
helper('setting');
37-
3836
/** @var JWT $authenticator */
3937
$authenticator = auth('jwt')->getAuthenticator();
4038

0 commit comments

Comments
 (0)