Skip to content

Commit 703e984

Browse files
committed
refactor: fix lint errors
1 parent fc5fd81 commit 703e984

23 files changed

Lines changed: 99 additions & 65 deletions

src/AbstractToken.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Staffbase\plugins\sdk;
@@ -18,7 +19,6 @@
1819

1920
abstract class AbstractToken
2021
{
21-
2222
private Token $token;
2323

2424
private Key $signerKey;
@@ -122,10 +122,10 @@ protected function getAllClaims(): array
122122
public static function base64ToPEMPublicKey(string $data): string
123123
{
124124

125-
$data = strtr($data, array(
125+
$data = strtr($data, [
126126
"\r" => "",
127-
"\n" => ""
128-
));
127+
"\n" => "",
128+
]);
129129

130130
return
131131
"-----BEGIN PUBLIC KEY-----\n" .

src/Exceptions/SSOAuthenticationException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* SSO Session implementation, based on this doc:
46
* https://developers.staffbase.com/api/plugin-sso/
@@ -9,7 +11,7 @@
911
* @license http://www.apache.org/licenses/LICENSE-2.0
1012
* @link https://github.com/staffbase/plugins-sdk-php
1113
*/
12-
14+
1315
namespace Staffbase\plugins\sdk\Exceptions;
1416

1517
/**
@@ -22,6 +24,4 @@
2224
* Can be used to identify cases which can
2325
* be handled with a soft http error eg.: 401.
2426
*/
25-
class SSOAuthenticationException extends SSOException
26-
{
27-
}
27+
class SSOAuthenticationException extends SSOException {}

src/Exceptions/SSOException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* SSO Session implementation, based on this doc:
46
* https://developers.staffbase.com/api/plugin-sso/
@@ -20,6 +22,4 @@
2022
* A general SSO Exception type to group
2123
* exceptions from this library.
2224
*/
23-
class SSOException extends Exception
24-
{
25-
}
25+
class SSOException extends Exception {}

src/PluginSession.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
/**
@@ -29,7 +30,9 @@
2930
*/
3031
class PluginSession implements SharedClaimsInterface, SSODataClaimsInterface
3132
{
32-
use SSODataTrait, SessionTokenDataTrait, DeleteInstanceTrait;
33+
use SSODataTrait;
34+
use SessionTokenDataTrait;
35+
use DeleteInstanceTrait;
3336

3437
public const QUERY_PARAM_JWT = 'jwt';
3538
public const QUERY_PARAM_PID = 'pid';
@@ -64,7 +67,7 @@ public function __construct(
6467
string $appSecret,
6568
?SessionHandlerInterface $sessionHandler = null,
6669
int $leeway = 0,
67-
?RemoteCallInterface $remoteCallHandler = null
70+
?RemoteCallInterface $remoteCallHandler = null,
6871
) {
6972
if (empty($pluginId)) {
7073
throw new SSOException('Empty plugin ID.');

src/RemoteCall/AbstractRemoteCallHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* Abstract remote handler implementation, based on this doc:
46
* https://developers.staffbase.com/api/plugin-sso/
@@ -9,6 +11,7 @@
911
* @license http://www.apache.org/licenses/LICENSE-2.0
1012
* @link https://github.com/staffbase/plugins-sdk-php
1113
*/
14+
1215
namespace Staffbase\plugins\sdk\RemoteCall;
1316

1417
/**

src/RemoteCall/DeleteInstanceCallHandlerInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* Delete remote handler interface, based on this doc:
46
* https://developers.staffbase.com/api/plugin-sso/
@@ -9,6 +11,7 @@
911
* @license http://www.apache.org/licenses/LICENSE-2.0
1012
* @link https://github.com/staffbase/plugins-sdk-php
1113
*/
14+
1215
namespace Staffbase\plugins\sdk\RemoteCall;
1316

1417
/**

src/RemoteCall/DeleteInstanceTrait.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Staffbase\plugins\sdk\RemoteCall;
46

57
trait DeleteInstanceTrait

src/RemoteCall/RemoteCallInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* Remote call interface, based on this doc:
46
* https://developers.staffbase.com/api/plugin-sso/
@@ -9,6 +11,7 @@
911
* @license http://www.apache.org/licenses/LICENSE-2.0
1012
* @link https://github.com/staffbase/plugins-sdk-php
1113
*/
14+
1215
namespace Staffbase\plugins\sdk\RemoteCall;
1316

1417
/**

src/SSOData.php

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Staffbase\plugins\sdk;
46

57
use Staffbase\plugins\sdk\SSOData\SharedDataTrait;
@@ -10,135 +12,136 @@
1012
*/
1113
abstract class SSOData
1214
{
13-
use SSODataTrait, SharedDataTrait;
15+
use SSODataTrait;
16+
use SharedDataTrait;
1417

1518
/**
1619
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_AUDIENCE
1720
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_AUDIENCE
1821
*/
19-
const CLAIM_AUDIENCE = 'aud';
22+
public const CLAIM_AUDIENCE = 'aud';
2023

2124
/**
2225
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_EXPIRE_AT
2326
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_EXPIRE_AT
2427
*/
25-
const CLAIM_EXPIRE_AT = 'exp';
28+
public const CLAIM_EXPIRE_AT = 'exp';
2629

2730
/**
2831
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_NOT_BEFORE
2932
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_NOT_BEFORE
3033
*/
31-
const CLAIM_NOT_BEFORE = 'nbf';
34+
public const CLAIM_NOT_BEFORE = 'nbf';
3235

3336
/**
3437
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_ISSUED_AT
3538
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_ISSUED_AT
3639
*/
37-
const CLAIM_ISSUED_AT = 'iat';
40+
public const CLAIM_ISSUED_AT = 'iat';
3841

3942
/**
4043
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_ISSUER
4144
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_ISSUER
4245
*/
43-
const CLAIM_ISSUER = 'iss';
46+
public const CLAIM_ISSUER = 'iss';
4447

4548
/**
4649
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_INSTANCE_ID
4750
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_INSTANCE_ID
4851
*/
49-
const CLAIM_INSTANCE_ID = 'instance_id';
52+
public const CLAIM_INSTANCE_ID = 'instance_id';
5053

5154
/**
5255
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_INSTANCE_NAME
5356
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_INSTANCE_NAME
5457
*/
55-
const CLAIM_INSTANCE_NAME = 'instance_name';
58+
public const CLAIM_INSTANCE_NAME = 'instance_name';
5659

5760
/**
5861
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_BRANCH_ID
5962
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_BRANCH_ID
6063
*/
61-
const CLAIM_BRANCH_ID = 'branch_id';
64+
public const CLAIM_BRANCH_ID = 'branch_id';
6265

6366
/**
6467
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_BRANCH_SLUG
6568
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_BRANCH_SLUG
6669
*/
67-
const CLAIM_BRANCH_SLUG = 'branch_slug';
70+
public const CLAIM_BRANCH_SLUG = 'branch_slug';
6871

6972
/**
7073
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_ID
7174
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_ID
7275
*/
73-
const CLAIM_USER_ID = 'sub';
76+
public const CLAIM_USER_ID = 'sub';
7477

7578
/**
7679
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_EXTERNAL_ID
7780
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_EXTERNAL_ID
7881
*/
79-
const CLAIM_USER_EXTERNAL_ID = 'external_id';
82+
public const CLAIM_USER_EXTERNAL_ID = 'external_id';
8083

8184
/**
8285
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_AUDIENCE
8386
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_AUDIENCE
8487
*/
85-
const CLAIM_USER_FULL_NAME = 'name';
88+
public const CLAIM_USER_FULL_NAME = 'name';
8689

8790
/**
8891
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::$USER_FIRST_NAME
8992
* @see \Staffbase\plugins\sdk\SSOToken::$USER_FIRST_NAME
9093
*/
91-
const CLAIM_USER_FIRST_NAME = 'given_name';
94+
public const CLAIM_USER_FIRST_NAME = 'given_name';
9295

9396
/**
9497
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::$USER_LAST_NAME
9598
* @see \Staffbase\plugins\sdk\SSOToken::$USER_LAST_NAME
9699
*/
97-
const CLAIM_USER_LAST_NAME = 'family_name';
100+
public const CLAIM_USER_LAST_NAME = 'family_name';
98101

99102
/**
100103
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_ROLE
101104
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_ROLE
102105
*/
103-
const CLAIM_USER_ROLE = 'role';
106+
public const CLAIM_USER_ROLE = 'role';
104107

105108
/**
106109
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_ENTITY_TYPE
107110
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_ENTITY_TYPE
108111
*/
109-
const CLAIM_ENTITY_TYPE = 'type';
112+
public const CLAIM_ENTITY_TYPE = 'type';
110113

111114
/**
112115
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_THEME_TEXT_COLOR
113116
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_THEME_TEXT_COLOR
114117
*/
115-
const CLAIM_THEME_TEXT_COLOR = 'theming_text';
118+
public const CLAIM_THEME_TEXT_COLOR = 'theming_text';
116119

117120
/**
118121
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_THEME_BACKGROUND_COLOR
119122
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_THEME_BACKGROUND_COLOR
120123
*/
121-
const CLAIM_THEME_BACKGROUND_COLOR = 'theming_bg';
124+
public const CLAIM_THEME_BACKGROUND_COLOR = 'theming_bg';
122125

123126
/**
124127
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_LOCALE
125128
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_LOCALE
126129
*/
127-
const CLAIM_USER_LOCALE = 'locale';
130+
public const CLAIM_USER_LOCALE = 'locale';
128131

129132
/**
130133
* @deprecated Please use \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_TAGS
131134
* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_USER_TAGS
132135
*/
133-
const CLAIM_USER_TAGS = 'tags';
136+
public const CLAIM_USER_TAGS = 'tags';
134137

135138
/**
136139
* @deprecated Will be removed
137140
*/
138-
const USER_ROLE_EDITOR = 'editor';
141+
public const USER_ROLE_EDITOR = 'editor';
139142

140143
/**
141144
* @deprecated Will be removed
142145
*/
143-
const REMOTE_CALL_DELETE = 'delete';
146+
public const REMOTE_CALL_DELETE = 'delete';
144147
}

src/SSOData/ClaimAccessTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
/**
@@ -18,7 +19,6 @@
1819
*/
1920
trait ClaimAccessTrait
2021
{
21-
2222
/**
2323
* Test if a claim is set.
2424
*

0 commit comments

Comments
 (0)