Skip to content

Commit f502ae4

Browse files
committed
Auto-fix CS
1 parent 5e6b4ae commit f502ae4

24 files changed

+81
-43
lines changed

src/Auth/AclAdapter/IniAclAdapter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function getAcl(array $availableRoles, array $config): array {
4040
$role = mb_substr($role, 1);
4141
if (!array_key_exists($role, $availableRoles)) {
4242
unset($roles[$roleId]);
43+
4344
continue;
4445
}
4546

@@ -52,6 +53,7 @@ public function getAcl(array $availableRoles, array $config): array {
5253
// Prevent undefined roles appearing in the iniMap
5354
if (!array_key_exists($role, $availableRoles) && $role !== '*') {
5455
unset($roles[$roleId]);
56+
5557
continue;
5658
}
5759
if ($role === '*') {

src/Auth/AclTrait.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ trait AclTrait {
5050
* Finds the authorization adapter to use for this request.
5151
*
5252
* @param string $adapter Acl adapter to load.
53-
* @return \TinyAuth\Auth\AclAdapter\AclAdapterInterface
5453
* @throws \Cake\Core\Exception\Exception
5554
* @throws \InvalidArgumentException
55+
* @return \TinyAuth\Auth\AclAdapter\AclAdapterInterface
5656
*/
5757
protected function _loadAclAdapter($adapter) {
5858
if ($this->_aclAdapter !== null) {
@@ -82,8 +82,8 @@ protected function _loadAclAdapter($adapter) {
8282
*
8383
* @param array $user User data
8484
* @param array $params Request params
85-
* @return bool Success
8685
* @throws \Cake\Core\Exception\Exception
86+
* @return bool Success
8787
*/
8888
protected function _checkUser(array $user, array $params) {
8989
if ($this->getConfig('includeAuthentication') && $this->_isPublic($params)) {
@@ -341,8 +341,8 @@ protected function _isPublic(array $params) {
341341
* Hack to get the auth data here for hasAccess().
342342
* We re-use the cached data for performance reasons.
343343
*
344-
* @return array
345344
* @throws \Cake\Core\Exception\Exception
345+
* @return array
346346
*/
347347
protected function _getAuth() {
348348
if ($this->auth) {
@@ -426,6 +426,7 @@ protected function _constructIniKey($params) {
426426
if (!empty($params['plugin'])) {
427427
$res = $params['plugin'] . ".$res";
428428
}
429+
429430
return $res;
430431
}
431432

@@ -435,8 +436,8 @@ protected function _constructIniKey($params) {
435436
* Will look for a roles array in
436437
* Configure first, tries database roles table next.
437438
*
438-
* @return int[] List with all available roles
439439
* @throws \Cake\Core\Exception\Exception
440+
* @return int[] List with all available roles
440441
*/
441442
protected function _getAvailableRoles() {
442443
if ($this->_roles !== null) {
@@ -496,8 +497,8 @@ protected function _getAvailableRoles() {
496497
* in multi-role mode)
497498
*
498499
* @param array $user The user to get the roles for
499-
* @return int[] List with all role ids belonging to the user
500500
* @throws \Cake\Core\Exception\Exception
501+
* @return int[] List with all role ids belonging to the user
501502
*/
502503
protected function _getUserRoles($user) {
503504
// Single-role from session
@@ -513,6 +514,7 @@ protected function _getUserRoles($user) {
513514
if (!isset($user[$this->getConfig('roleColumn')])) {
514515
return [];
515516
}
517+
516518
return $this->_mapped([$user[$this->getConfig('roleColumn')]]);
517519
}
518520

@@ -522,6 +524,7 @@ protected function _getUserRoles($user) {
522524
if (isset($userRoles[0]['id'])) {
523525
$userRoles = Hash::extract($userRoles, '{n}.id');
524526
}
527+
525528
return $this->_mapped((array)$userRoles);
526529
}
527530

@@ -532,6 +535,7 @@ protected function _getUserRoles($user) {
532535
if (isset($userRoles[0][$this->getConfig('roleColumn')])) {
533536
$userRoles = Hash::extract($userRoles, '{n}.' . $this->getConfig('roleColumn'));
534537
}
538+
535539
return $this->_mapped((array)$userRoles);
536540
}
537541

@@ -550,8 +554,8 @@ protected function _getUserRoles($user) {
550554
protected function _pivotTableName() {
551555
$pivotTableName = $this->getConfig('pivotTable');
552556
if (!$pivotTableName) {
553-
list(, $rolesTableName) = pluginSplit($this->getConfig('rolesTable'));
554-
list(, $usersTableName) = pluginSplit($this->getConfig('usersTable'));
557+
[, $rolesTableName] = pluginSplit($this->getConfig('rolesTable'));
558+
[, $usersTableName] = pluginSplit($this->getConfig('usersTable'));
555559
$tables = [
556560
$usersTableName,
557561
$rolesTableName,

src/Auth/AllowAdapter/IniAllowAdapter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function getAllow(array $config): array {
2424
$action = trim($action);
2525
if ($action === '') {
2626
unset($actions[$k]);
27+
2728
continue;
2829
}
2930
$actions[$k] = $action;
@@ -39,6 +40,7 @@ public function getAllow(array $config): array {
3940
$denied = mb_substr($action, 0, 1) === '!';
4041
if ($denied) {
4142
$auth[$key]['deny'][] = mb_substr($action, 1);
43+
4244
continue;
4345
}
4446

src/Auth/AllowTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ protected function _getAllow($path = null) {
138138
* Finds the authentication adapter to use for this request.
139139
*
140140
* @param string $adapter Acl adapter to load.
141-
* @return \TinyAuth\Auth\AllowAdapter\AllowAdapterInterface
142141
* @throws \Cake\Core\Exception\Exception
143142
* @throws \InvalidArgumentException
143+
* @return \TinyAuth\Auth\AllowAdapter\AllowAdapterInterface
144144
*/
145145
protected function _loadAllowAdapter($adapter) {
146146
if ($this->_allowAdapter !== null) {

src/Auth/AuthUserTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function id() {
5959
*/
6060
public function isMe($userId) {
6161
$field = $this->getConfig('idColumn');
62+
6263
return $userId && (string)$userId === (string)$this->user($field);
6364
}
6465

@@ -73,6 +74,7 @@ public function user($key = null) {
7374
if ($key === null) {
7475
return $user;
7576
}
77+
7678
return Hash::get($user, $key);
7779
}
7880

@@ -116,6 +118,7 @@ public function hasRole($expectedRole, $providedRoles = null) {
116118
if (array_key_exists($expectedRole, $roles) || in_array($expectedRole, $roles)) {
117119
return true;
118120
}
121+
119122
return false;
120123
}
121124

@@ -159,6 +162,7 @@ public function hasRoles($expectedRoles, $oneRoleIsEnough = true, $providedRoles
159162
if ($count === count($expectedRoles)) {
160163
return true;
161164
}
165+
162166
return false;
163167
}
164168

src/Controller/Component/AuthComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace TinyAuth\Controller\Component;
44

5-
use Cake\Controller\ComponentRegistry;
65
use Cake\Controller\Component\AuthComponent as CakeAuthComponent;
6+
use Cake\Controller\ComponentRegistry;
77
use RuntimeException;
88
use TinyAuth\Auth\AclTrait;
99
use TinyAuth\Auth\AllowTrait;

src/Middleware/RequestAuthorizationMiddleware.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
5858
$can = $service->can($identity, $this->getConfig('method'), $request);
5959
if (!$can) {
6060
$result = new Result($can, 'Can not ' . $this->getConfig('method') . ' request');
61+
6162
throw new ForbiddenException($result);
6263
}
6364

src/Panel/AuthPanel.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class AuthPanel extends DebugPanel {
1919
use AllowTrait;
2020
use InstanceConfigTrait;
2121

22-
const ICON_RESTRICTED = "\u{1f512}";
23-
const ICON_PUBLIC = "\u{1f513}";
22+
public const ICON_RESTRICTED = "\u{1f512}";
23+
public const ICON_PUBLIC = "\u{1f513}";
2424

2525
/**
2626
* Defines which plugin this panel is from so the element can be located.
@@ -57,7 +57,7 @@ public function __construct() {
5757
* @return void
5858
*/
5959
public function shutdown(EventInterface $event) {
60-
/** @var \Cake\Controller\Controller $controller */
60+
/** @var \Cake\Controller\Controller $controller */
6161
$controller = $event->getSubject();
6262
$request = $controller->getRequest();
6363

@@ -102,6 +102,7 @@ public function data() {
102102
$data = [
103103
'isPublic' => $this->isPublic,
104104
];
105+
105106
return $this->_data + $data;
106107
}
107108

@@ -143,6 +144,7 @@ protected function _injectRole(array $user, $role, $id) {
143144
$pivotTableName = $this->_pivotTableName();
144145
if (isset($user[$pivotTableName])) {
145146
$user[$pivotTableName] = [$role => $id];
147+
146148
return $user;
147149
}
148150

src/Sync/Syncer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function syncAcl(Arguments $args, ConsoleIo $io) {
5454
$io->info($string);
5555
$io->info('=== ' . $config['aclFile'] . ' end ===');
5656
}
57+
5758
return;
5859
}
5960

src/Utility/Cache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Cache {
1414

1515
use StaticConfigTrait;
1616

17-
const KEY_ALLOW = 'allow';
18-
const KEY_ACL = 'acl';
17+
public const KEY_ALLOW = 'allow';
18+
public const KEY_ACL = 'acl';
1919

2020
/**
2121
* @var array

0 commit comments

Comments
 (0)