Passed
Pull Request — master (#1337)
by
unknown
03:36
created
controller/Controller.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
 		// Check if we have an authentication provider configured
50 50
 		// If so; check if the configured provider is actually a class we can use
51
-		if ( ( $authProvider = $this->model->getConfig()->getAuthenticationProvider() ) && class_exists( $authProvider ) ) {
52
-			$this->invokeAuthenticationLayer( new $authProvider($this) );
51
+		if (($authProvider = $this->model->getConfig()->getAuthenticationProvider()) && class_exists($authProvider)) {
52
+			$this->invokeAuthenticationLayer(new $authProvider($this));
53 53
 		}
54 54
     }
55 55
 
@@ -59,27 +59,27 @@  discard block
 block discarded – undo
59 59
 	 * @param BaseAuthInterface $provider
60 60
 	 * @return void
61 61
 	 */
62
-	private function invokeAuthenticationLayer( BaseAuthInterface $authProvider ) {
62
+	private function invokeAuthenticationLayer(BaseAuthInterface $authProvider) {
63 63
 
64 64
 		// Validate the authentication provider's configuration parameters
65
-		if ( $authProvider->validate() ) {
65
+		if ($authProvider->validate()) {
66 66
 
67 67
 			// We don't have a valid user session; so sign in the user
68
-			if ( !$authProvider->isSignedIn() ) {
68
+			if (!$authProvider->isSignedIn()) {
69 69
 				$authProvider->signIn();
70 70
 
71 71
 			// We have a valid session for this user; see if it wants to do anything..
72
-			} else if ( isset ( $_GET[ 'auth_do' ] ) ) {
73
-				$action = $_GET[ 'auth_do' ];
72
+			} else if (isset ($_GET['auth_do'])) {
73
+				$action = $_GET['auth_do'];
74 74
 
75 75
 				// Signout
76
-				if ( $action === 'signout' ) {
76
+				if ($action === 'signout') {
77 77
 					$authProvider->signOut();
78 78
 
79 79
 				// Retrieve user info
80
-				} else if ( $action === 'info' ) {
81
-					echo json_encode( $authProvider->getUserAttributes() );
82
-					$this->sendHeader('Content-Type: application/json' );
80
+				} else if ($action === 'info') {
81
+					echo json_encode($authProvider->getUserAttributes());
82
+					$this->sendHeader('Content-Type: application/json');
83 83
 					exit();
84 84
 				}
85 85
 			}
@@ -195,18 +195,18 @@  discard block
 block discarded – undo
195 195
         $localname = $vocab->getLocalName($uri);
196 196
         if ($localname !== $uri && $localname === urlencode($localname)) {
197 197
             // check that the prefix stripping worked, and there are no problematic chars in localname
198
-            $paramstr = count($params) > 0 ? '?' . http_build_query($params) : '';
198
+            $paramstr = count($params) > 0 ? '?'.http_build_query($params) : '';
199 199
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
200
-                return "$vocid/$lang/$type/$localname" . $paramstr;
200
+                return "$vocid/$lang/$type/$localname".$paramstr;
201 201
             }
202 202
 
203
-            return "$vocid/$lang/$localname" . $paramstr;
203
+            return "$vocid/$lang/$localname".$paramstr;
204 204
         }
205 205
 
206 206
         // case 2: URI outside vocabulary namespace, or has problematic chars
207 207
         // pass the full URI as parameter instead
208 208
         $params['uri'] = $uri;
209
-        return "$vocid/$lang/$type/?" . http_build_query($params);
209
+        return "$vocid/$lang/$type/?".http_build_query($params);
210 210
     }
211 211
 
212 212
     /**
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     {
333 333
         if ($modifiedDate) {
334 334
             $ifModifiedSince = $this->getIfModifiedSince();
335
-            $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T'));
335
+            $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T'));
336 336
             if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) {
337 337
                 $this->sendHeader("HTTP/1.0 304 Not Modified");
338 338
                 return true;
Please login to merge, or discard this patch.
controller/Auth/BaseAuthInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 interface BaseAuthInterface {
4 4
 
5
-	public function __construct( Controller $controller );
5
+	public function __construct(Controller $controller);
6 6
 
7 7
 	/**
8 8
 	 * Validate if all requirements are met to load this
Please login to merge, or discard this patch.
controller/Auth/SimpleSamlPHP/SimpleSamlPHP.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @param Model $model
34 34
 	 */
35
-	public function __construct( Controller $controller ) {
35
+	public function __construct(Controller $controller) {
36 36
 		$this->model = $controller->model;
37 37
 		$this->baseHref = $controller->getBaseHref();
38 38
 	}
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	 * @inheritDoc
42 42
 	 */
43 43
 	public function validate(): bool {
44
-		$authDirectory = $this->model->getConfig()->getLiteral( 'skosmos:authProviderIncludeDirectory' );
45
-		if ( !$authDirectory ) {
44
+		$authDirectory = $this->model->getConfig()->getLiteral('skosmos:authProviderIncludeDirectory');
45
+		if (!$authDirectory) {
46 46
 			return false;
47 47
 		}
48 48
 
49
-		$authEntity = $this->model->getConfig()->getLiteral( 'skosmos:authProviderAuthEntity' );
50
-		if ( !$authEntity ) {
49
+		$authEntity = $this->model->getConfig()->getLiteral('skosmos:authProviderAuthEntity');
50
+		if (!$authEntity) {
51 51
 			return false;
52 52
 		} else {
53 53
 			$this->authEntity = $authEntity;
54 54
 		}
55 55
 
56
-		$sspAutoloader = $authDirectory . DIRECTORY_SEPARATOR . 'lib/_autoload.php';
57
-		if ( !file_exists( $sspAutoloader ) ) {
56
+		$sspAutoloader = $authDirectory.DIRECTORY_SEPARATOR.'lib/_autoload.php';
57
+		if (!file_exists($sspAutoloader)) {
58 58
 			return false;
59 59
 		} else {
60 60
 			require $sspAutoloader;
@@ -67,32 +67,32 @@  discard block
 block discarded – undo
67 67
 	 * @inheritDoc
68 68
 	 */
69 69
 	public function isSignedIn(): bool {
70
-		return $this->getSessionFromRequest()->isValid( $this->authEntity );
70
+		return $this->getSessionFromRequest()->isValid($this->authEntity);
71 71
 	}
72 72
 
73 73
 	/**
74 74
 	 * @inheritDoc
75 75
 	 */
76 76
 	public function signIn() {
77
-		$this->getAuthenticationSource()->requireAuth( [
77
+		$this->getAuthenticationSource()->requireAuth([
78 78
 			'ReturnTo' => $this->baseHref
79
-		] );
79
+		]);
80 80
 	}
81 81
 
82 82
 	/**
83 83
 	 * @inheritDoc
84 84
 	 */
85 85
 	public function signOut() {
86
-		$this->getAuthenticationSource()->logout( [
86
+		$this->getAuthenticationSource()->logout([
87 87
 			'ReturnTo' => $this->baseHref
88
-		] );
88
+		]);
89 89
 	}
90 90
 
91 91
 	/**
92 92
 	 * @inheritDoc
93 93
 	 */
94 94
 	public function getUserAttributes(): array {
95
-		if ( $this->isSignedIn() ) {
95
+		if ($this->isSignedIn()) {
96 96
 			return [];
97 97
 		}
98 98
 		return [
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return \SimpleSAML\Auth\Simple
106 106
 	 */
107 107
 	private function getAuthenticationSource( ) {
108
-		return new SimpleSAML\Auth\Simple( $this->authEntity );
108
+		return new SimpleSAML\Auth\Simple($this->authEntity);
109 109
 	}
110 110
 
111 111
 	/**
Please login to merge, or discard this patch.
model/BaseConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      * @param string $lang preferred language for the literal
45 45
      * @return string string value for the given property, or the default value if not found
46 46
      */
47
-    public function getLiteral( $property, $default=null, $lang=null)
47
+    public function getLiteral($property, $default = null, $lang = null)
48 48
     {
49 49
         if (!isset($lang)) {
50 50
             $lang = $this->getEnvLang();
Please login to merge, or discard this patch.