Skip to content

Commit f674f6e

Browse files
committed
Change code in SolidUserProfile route to be cleaner
- Fix dynamic calls to static method - Dead code (remove unused variable) - Use statements (remove unused, sort alphabetically)
1 parent dec76cc commit f674f6e

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

lib/Routes/SolidUserProfile.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
<?php
22
namespace Pdsinterop\PhpSolid\Routes;
33

4+
use Laminas\Diactoros\Response;
5+
use Laminas\Diactoros\ServerRequestFactory;
46
use Pdsinterop\PhpSolid\ProfileServer;
5-
use Pdsinterop\PhpSolid\ClientRegistration;
67
use Pdsinterop\PhpSolid\SolidNotifications;
78
use Pdsinterop\PhpSolid\Util;
89
use Pdsinterop\Solid\Auth\WAC;
910
use Pdsinterop\Solid\Resources\Server as ResourceServer;
10-
use Laminas\Diactoros\ServerRequestFactory;
11-
use Laminas\Diactoros\Response;
1211

1312
class SolidUserProfile {
1413
public static function respondToProfile() {
1514
$requestFactory = new ServerRequestFactory();
16-
$serverData = $_SERVER;
17-
18-
$rawRequest = $requestFactory->fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
15+
$rawRequest = $requestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
1916
ProfileServer::initializeProfile();
2017
$filesystem = ProfileServer::getFileSystem();
2118

@@ -31,7 +28,7 @@ public static function respondToProfile() {
3128
$wac->setBaseUrl($baseUrl);
3229

3330
// use the original $_SERVER without modified path, otherwise the htu check for DPOP will fail
34-
$webId = ProfileServer::getWebId($requestFactory->fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES));
31+
$webId = ProfileServer::getWebId($requestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES));
3532

3633
if (!isset($webId)) {
3734
$response = $resourceServer->getResponse()
@@ -45,7 +42,6 @@ public static function respondToProfile() {
4542
// FIXME: Read allowed clients from the profile instead;
4643
$owner = ProfileServer::getOwner();
4744

48-
$allowedClients = $owner['allowedClients'] ?? [];
4945
$allowedOrigins = array_merge(
5046
($owner['allowedOrigins'] ?? []),
5147
(TRUSTED_APPS ?? [])
@@ -68,4 +64,3 @@ public static function respondToProfile() {
6864
ProfileServer::respond($response);
6965
}
7066
}
71-

0 commit comments

Comments
 (0)