Skip to content

Commit a5f9fa7

Browse files
authored
Use static instead of self when calling static functions to allow easier customisation in subclasses (limosa-io#96)
1 parent f913bbf commit a5f9fa7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Http/Controllers/ResourceController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public static function createFromSCIM($resourceType, $input, PolicyDecisionPoint
5555
}
5656

5757
$flattened = Helper::flatten($input, $input['schemas']);
58-
$flattened = self::validateScim($resourceType, $flattened, null);
58+
$flattened = static::validateScim($resourceType, $flattened, null);
5959

60-
if (!$allowAlways && !self::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_POST, $flattened, $resourceType, null, $isMe)) {
60+
if (!$allowAlways && !static::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_POST, $flattened, $resourceType, null, $isMe)) {
6161
throw (new SCIMException('This is not allowed'))->setCode(403);
6262
}
6363

@@ -68,7 +68,7 @@ public static function createFromSCIM($resourceType, $input, PolicyDecisionPoint
6868
//validate
6969
$newObject = Helper::flatten(Helper::objectToSCIMArray($resourceObject, $resourceType), $resourceType->getSchema());
7070

71-
$flattened = self::validateScim($resourceType, $newObject, $resourceObject);
71+
$flattened = static::validateScim($resourceType, $newObject, $resourceObject);
7272

7373
$resourceObject->save();
7474

@@ -82,7 +82,7 @@ public function createObject(Request $request, PolicyDecisionPoint $pdp, Resourc
8282
{
8383
$input = $request->input();
8484

85-
$resourceObject = self::createFromSCIM($resourceType, $input, $pdp, $request, false, $isMe);
85+
$resourceObject = static::createFromSCIM($resourceType, $input, $pdp, $request, false, $isMe);
8686

8787
event(new Create($resourceObject, $resourceType, $isMe, $request->input()));
8888

@@ -130,7 +130,7 @@ public function replace(Request $request, PolicyDecisionPoint $pdp, ResourceType
130130

131131
$flattened = $this->validateScim($resourceType, $newObject, $resourceObject);
132132

133-
if (!self::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
133+
if (!static::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
134134
throw new SCIMException('This is not allowed');
135135
}
136136

@@ -185,7 +185,7 @@ public function update(Request $request, PolicyDecisionPoint $pdp, ResourceType
185185

186186
$flattened = $this->validateScim($resourceType, $newObject, $resourceObject);
187187

188-
if (!self::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
188+
if (!static::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
189189
throw new SCIMException('This is not allowed');
190190
}
191191

0 commit comments

Comments
 (0)