Passed
Push — master ( a1ed1d...263a69 )
by John
16:05 queued 13s
created
lib/private/IntegrityCheck/Helpers/AppLocator.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -34,27 +34,27 @@
 block discarded – undo
34 34
  * @package OC\IntegrityCheck\Helpers
35 35
  */
36 36
 class AppLocator {
37
-	/**
38
-	 * Provides \OC_App::getAppPath($appId)
39
-	 *
40
-	 * @param string $appId
41
-	 * @return string
42
-	 * @throws \Exception If the app cannot be found
43
-	 */
44
-	public function getAppPath(string $appId): string {
45
-		$path = \OC_App::getAppPath($appId);
46
-		if ($path === false) {
47
-			throw new \Exception('App not found');
48
-		}
49
-		return $path;
50
-	}
37
+    /**
38
+     * Provides \OC_App::getAppPath($appId)
39
+     *
40
+     * @param string $appId
41
+     * @return string
42
+     * @throws \Exception If the app cannot be found
43
+     */
44
+    public function getAppPath(string $appId): string {
45
+        $path = \OC_App::getAppPath($appId);
46
+        if ($path === false) {
47
+            throw new \Exception('App not found');
48
+        }
49
+        return $path;
50
+    }
51 51
 
52
-	/**
53
-	 * Providers \OC_App::getAllApps()
54
-	 *
55
-	 * @return array
56
-	 */
57
-	public function getAllApps(): array {
58
-		return \OC_App::getAllApps();
59
-	}
52
+    /**
53
+     * Providers \OC_App::getAllApps()
54
+     *
55
+     * @return array
56
+     */
57
+    public function getAllApps(): array {
58
+        return \OC_App::getAllApps();
59
+    }
60 60
 }
Please login to merge, or discard this patch.
lib/private/Federation/CloudFederationNotification.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,35 +33,35 @@
 block discarded – undo
33 33
  * @since 14.0.0
34 34
  */
35 35
 class CloudFederationNotification implements ICloudFederationNotification {
36
-	private $message = [];
36
+    private $message = [];
37 37
 
38
-	/**
39
-	 * add a message to the notification
40
-	 *
41
-	 * @param string $notificationType (e.g. SHARE_ACCEPTED)
42
-	 * @param string $resourceType (e.g. file, calendar, contact,...)
43
-	 * @param string $providerId id of the share
44
-	 * @param array $notification payload of the notification
45
-	 *
46
-	 * @since 14.0.0
47
-	 */
48
-	public function setMessage($notificationType, $resourceType, $providerId, array $notification) {
49
-		$this->message = [
50
-			'notificationType' => $notificationType,
51
-			'resourceType' => $resourceType,
52
-			'providerId' => $providerId,
53
-			'notification' => $notification,
54
-		];
55
-	}
38
+    /**
39
+     * add a message to the notification
40
+     *
41
+     * @param string $notificationType (e.g. SHARE_ACCEPTED)
42
+     * @param string $resourceType (e.g. file, calendar, contact,...)
43
+     * @param string $providerId id of the share
44
+     * @param array $notification payload of the notification
45
+     *
46
+     * @since 14.0.0
47
+     */
48
+    public function setMessage($notificationType, $resourceType, $providerId, array $notification) {
49
+        $this->message = [
50
+            'notificationType' => $notificationType,
51
+            'resourceType' => $resourceType,
52
+            'providerId' => $providerId,
53
+            'notification' => $notification,
54
+        ];
55
+    }
56 56
 
57
-	/**
58
-	 * get message, ready to send out
59
-	 *
60
-	 * @return array
61
-	 *
62
-	 * @since 14.0.0
63
-	 */
64
-	public function getMessage() {
65
-		return $this->message;
66
-	}
57
+    /**
58
+     * get message, ready to send out
59
+     *
60
+     * @return array
61
+     *
62
+     * @since 14.0.0
63
+     */
64
+    public function getMessage() {
65
+        return $this->message;
66
+    }
67 67
 }
Please login to merge, or discard this patch.
lib/private/App/AppStore/Version/VersionParser.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -30,56 +30,56 @@
 block discarded – undo
30 30
  * @package OC\App\AppStore
31 31
  */
32 32
 class VersionParser {
33
-	/**
34
-	 * @param string $versionString
35
-	 * @return bool
36
-	 */
37
-	private function isValidVersionString($versionString) {
38
-		return (bool)preg_match('/^[0-9.]+$/', $versionString);
39
-	}
33
+    /**
34
+     * @param string $versionString
35
+     * @return bool
36
+     */
37
+    private function isValidVersionString($versionString) {
38
+        return (bool)preg_match('/^[0-9.]+$/', $versionString);
39
+    }
40 40
 
41
-	/**
42
-	 * Returns the version for a version string
43
-	 *
44
-	 * @param string $versionSpec
45
-	 * @return Version
46
-	 * @throws \Exception If the version cannot be parsed
47
-	 */
48
-	public function getVersion($versionSpec) {
49
-		// * indicates that the version is compatible with all versions
50
-		if ($versionSpec === '*') {
51
-			return new Version('', '');
52
-		}
41
+    /**
42
+     * Returns the version for a version string
43
+     *
44
+     * @param string $versionSpec
45
+     * @return Version
46
+     * @throws \Exception If the version cannot be parsed
47
+     */
48
+    public function getVersion($versionSpec) {
49
+        // * indicates that the version is compatible with all versions
50
+        if ($versionSpec === '*') {
51
+            return new Version('', '');
52
+        }
53 53
 
54
-		// Count the amount of =, if it is one then it's either maximum or minimum
55
-		// version. If it is two then it is maximum and minimum.
56
-		$versionElements = explode(' ', $versionSpec);
57
-		$firstVersion = isset($versionElements[0]) ? $versionElements[0] : '';
58
-		$firstVersionNumber = substr($firstVersion, 2);
59
-		$secondVersion = isset($versionElements[1]) ? $versionElements[1] : '';
60
-		$secondVersionNumber = substr($secondVersion, 2);
54
+        // Count the amount of =, if it is one then it's either maximum or minimum
55
+        // version. If it is two then it is maximum and minimum.
56
+        $versionElements = explode(' ', $versionSpec);
57
+        $firstVersion = isset($versionElements[0]) ? $versionElements[0] : '';
58
+        $firstVersionNumber = substr($firstVersion, 2);
59
+        $secondVersion = isset($versionElements[1]) ? $versionElements[1] : '';
60
+        $secondVersionNumber = substr($secondVersion, 2);
61 61
 
62
-		switch (count($versionElements)) {
63
-			case 1:
64
-				if (!$this->isValidVersionString($firstVersionNumber)) {
65
-					break;
66
-				}
67
-				if (strpos($firstVersion, '>') === 0) {
68
-					return new Version($firstVersionNumber, '');
69
-				}
70
-				return new Version('', $firstVersionNumber);
71
-			case 2:
72
-				if (!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
73
-					break;
74
-				}
75
-				return new Version($firstVersionNumber, $secondVersionNumber);
76
-		}
62
+        switch (count($versionElements)) {
63
+            case 1:
64
+                if (!$this->isValidVersionString($firstVersionNumber)) {
65
+                    break;
66
+                }
67
+                if (strpos($firstVersion, '>') === 0) {
68
+                    return new Version($firstVersionNumber, '');
69
+                }
70
+                return new Version('', $firstVersionNumber);
71
+            case 2:
72
+                if (!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
73
+                    break;
74
+                }
75
+                return new Version($firstVersionNumber, $secondVersionNumber);
76
+        }
77 77
 
78
-		throw new \Exception(
79
-			sprintf(
80
-				'Version cannot be parsed: %s',
81
-				$versionSpec
82
-			)
83
-		);
84
-	}
78
+        throw new \Exception(
79
+            sprintf(
80
+                'Version cannot be parsed: %s',
81
+                $versionSpec
82
+            )
83
+        );
84
+    }
85 85
 }
Please login to merge, or discard this patch.
lib/private/Security/FeaturePolicy/FeaturePolicy.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -27,51 +27,51 @@
 block discarded – undo
27 27
 namespace OC\Security\FeaturePolicy;
28 28
 
29 29
 class FeaturePolicy extends \OCP\AppFramework\Http\FeaturePolicy {
30
-	public function getAutoplayDomains(): array {
31
-		return $this->autoplayDomains;
32
-	}
30
+    public function getAutoplayDomains(): array {
31
+        return $this->autoplayDomains;
32
+    }
33 33
 
34
-	public function setAutoplayDomains(array $autoplayDomains): void {
35
-		$this->autoplayDomains = $autoplayDomains;
36
-	}
34
+    public function setAutoplayDomains(array $autoplayDomains): void {
35
+        $this->autoplayDomains = $autoplayDomains;
36
+    }
37 37
 
38
-	public function getCameraDomains(): array {
39
-		return $this->cameraDomains;
40
-	}
38
+    public function getCameraDomains(): array {
39
+        return $this->cameraDomains;
40
+    }
41 41
 
42
-	public function setCameraDomains(array $cameraDomains): void {
43
-		$this->cameraDomains = $cameraDomains;
44
-	}
42
+    public function setCameraDomains(array $cameraDomains): void {
43
+        $this->cameraDomains = $cameraDomains;
44
+    }
45 45
 
46
-	public function getFullscreenDomains(): array {
47
-		return $this->fullscreenDomains;
48
-	}
46
+    public function getFullscreenDomains(): array {
47
+        return $this->fullscreenDomains;
48
+    }
49 49
 
50
-	public function setFullscreenDomains(array $fullscreenDomains): void {
51
-		$this->fullscreenDomains = $fullscreenDomains;
52
-	}
50
+    public function setFullscreenDomains(array $fullscreenDomains): void {
51
+        $this->fullscreenDomains = $fullscreenDomains;
52
+    }
53 53
 
54
-	public function getGeolocationDomains(): array {
55
-		return $this->geolocationDomains;
56
-	}
54
+    public function getGeolocationDomains(): array {
55
+        return $this->geolocationDomains;
56
+    }
57 57
 
58
-	public function setGeolocationDomains(array $geolocationDomains): void {
59
-		$this->geolocationDomains = $geolocationDomains;
60
-	}
58
+    public function setGeolocationDomains(array $geolocationDomains): void {
59
+        $this->geolocationDomains = $geolocationDomains;
60
+    }
61 61
 
62
-	public function getMicrophoneDomains(): array {
63
-		return $this->microphoneDomains;
64
-	}
62
+    public function getMicrophoneDomains(): array {
63
+        return $this->microphoneDomains;
64
+    }
65 65
 
66
-	public function setMicrophoneDomains(array $microphoneDomains): void {
67
-		$this->microphoneDomains = $microphoneDomains;
68
-	}
66
+    public function setMicrophoneDomains(array $microphoneDomains): void {
67
+        $this->microphoneDomains = $microphoneDomains;
68
+    }
69 69
 
70
-	public function getPaymentDomains(): array {
71
-		return $this->paymentDomains;
72
-	}
70
+    public function getPaymentDomains(): array {
71
+        return $this->paymentDomains;
72
+    }
73 73
 
74
-	public function setPaymentDomains(array $paymentDomains): void {
75
-		$this->paymentDomains = $paymentDomains;
76
-	}
74
+    public function setPaymentDomains(array $paymentDomains): void {
75
+        $this->paymentDomains = $paymentDomains;
76
+    }
77 77
 }
Please login to merge, or discard this patch.
lib/private/Security/IdentityProof/Signer.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -32,76 +32,76 @@
 block discarded – undo
32 32
 use OCP\IUserManager;
33 33
 
34 34
 class Signer {
35
-	/** @var Manager */
36
-	private $keyManager;
37
-	/** @var ITimeFactory */
38
-	private $timeFactory;
39
-	/** @var IUserManager */
40
-	private $userManager;
35
+    /** @var Manager */
36
+    private $keyManager;
37
+    /** @var ITimeFactory */
38
+    private $timeFactory;
39
+    /** @var IUserManager */
40
+    private $userManager;
41 41
 
42
-	/**
43
-	 * @param Manager $keyManager
44
-	 * @param ITimeFactory $timeFactory
45
-	 * @param IUserManager $userManager
46
-	 */
47
-	public function __construct(Manager $keyManager,
48
-								ITimeFactory $timeFactory,
49
-								IUserManager $userManager) {
50
-		$this->keyManager = $keyManager;
51
-		$this->timeFactory = $timeFactory;
52
-		$this->userManager = $userManager;
53
-	}
42
+    /**
43
+     * @param Manager $keyManager
44
+     * @param ITimeFactory $timeFactory
45
+     * @param IUserManager $userManager
46
+     */
47
+    public function __construct(Manager $keyManager,
48
+                                ITimeFactory $timeFactory,
49
+                                IUserManager $userManager) {
50
+        $this->keyManager = $keyManager;
51
+        $this->timeFactory = $timeFactory;
52
+        $this->userManager = $userManager;
53
+    }
54 54
 
55
-	/**
56
-	 * Returns a signed blob for $data
57
-	 *
58
-	 * @param string $type
59
-	 * @param array $data
60
-	 * @param IUser $user
61
-	 * @return array ['message', 'signature']
62
-	 */
63
-	public function sign(string $type, array $data, IUser $user): array {
64
-		$privateKey = $this->keyManager->getKey($user)->getPrivate();
65
-		$data = [
66
-			'data' => $data,
67
-			'type' => $type,
68
-			'signer' => $user->getCloudId(),
69
-			'timestamp' => $this->timeFactory->getTime(),
70
-		];
71
-		openssl_sign(json_encode($data), $signature, $privateKey, OPENSSL_ALGO_SHA512);
55
+    /**
56
+     * Returns a signed blob for $data
57
+     *
58
+     * @param string $type
59
+     * @param array $data
60
+     * @param IUser $user
61
+     * @return array ['message', 'signature']
62
+     */
63
+    public function sign(string $type, array $data, IUser $user): array {
64
+        $privateKey = $this->keyManager->getKey($user)->getPrivate();
65
+        $data = [
66
+            'data' => $data,
67
+            'type' => $type,
68
+            'signer' => $user->getCloudId(),
69
+            'timestamp' => $this->timeFactory->getTime(),
70
+        ];
71
+        openssl_sign(json_encode($data), $signature, $privateKey, OPENSSL_ALGO_SHA512);
72 72
 
73
-		return [
74
-			'message' => $data,
75
-			'signature' => base64_encode($signature),
76
-		];
77
-	}
73
+        return [
74
+            'message' => $data,
75
+            'signature' => base64_encode($signature),
76
+        ];
77
+    }
78 78
 
79
-	/**
80
-	 * Whether the data is signed properly
81
-	 *
82
-	 * @param array $data
83
-	 * @return bool
84
-	 */
85
-	public function verify(array $data): bool {
86
-		if (isset($data['message'])
87
-			&& isset($data['signature'])
88
-			&& isset($data['message']['signer'])
89
-		) {
90
-			$location = strrpos($data['message']['signer'], '@');
91
-			$userId = substr($data['message']['signer'], 0, $location);
79
+    /**
80
+     * Whether the data is signed properly
81
+     *
82
+     * @param array $data
83
+     * @return bool
84
+     */
85
+    public function verify(array $data): bool {
86
+        if (isset($data['message'])
87
+            && isset($data['signature'])
88
+            && isset($data['message']['signer'])
89
+        ) {
90
+            $location = strrpos($data['message']['signer'], '@');
91
+            $userId = substr($data['message']['signer'], 0, $location);
92 92
 
93
-			$user = $this->userManager->get($userId);
94
-			if ($user !== null) {
95
-				$key = $this->keyManager->getKey($user);
96
-				return (bool)openssl_verify(
97
-					json_encode($data['message']),
98
-					base64_decode($data['signature']),
99
-					$key->getPublic(),
100
-					OPENSSL_ALGO_SHA512
101
-				);
102
-			}
103
-		}
93
+            $user = $this->userManager->get($userId);
94
+            if ($user !== null) {
95
+                $key = $this->keyManager->getKey($user);
96
+                return (bool)openssl_verify(
97
+                    json_encode($data['message']),
98
+                    base64_decode($data['signature']),
99
+                    $key->getPublic(),
100
+                    OPENSSL_ALGO_SHA512
101
+                );
102
+            }
103
+        }
104 104
 
105
-		return false;
106
-	}
105
+        return false;
106
+    }
107 107
 }
Please login to merge, or discard this patch.
lib/private/Security/CSRF/CsrfToken.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -36,46 +36,46 @@
 block discarded – undo
36 36
  * @package OC\Security\CSRF
37 37
  */
38 38
 class CsrfToken {
39
-	/** @var string */
40
-	private $value;
41
-	/** @var string */
42
-	private $encryptedValue = '';
39
+    /** @var string */
40
+    private $value;
41
+    /** @var string */
42
+    private $encryptedValue = '';
43 43
 
44
-	/**
45
-	 * @param string $value Value of the token. Can be encrypted or not encrypted.
46
-	 */
47
-	public function __construct(string $value) {
48
-		$this->value = $value;
49
-	}
44
+    /**
45
+     * @param string $value Value of the token. Can be encrypted or not encrypted.
46
+     */
47
+    public function __construct(string $value) {
48
+        $this->value = $value;
49
+    }
50 50
 
51
-	/**
52
-	 * Encrypted value of the token. This is used to mitigate BREACH alike
53
-	 * vulnerabilities. For display measures do use this functionality.
54
-	 *
55
-	 * @return string
56
-	 */
57
-	public function getEncryptedValue(): string {
58
-		if ($this->encryptedValue === '') {
59
-			$sharedSecret = random_bytes(\strlen($this->value));
60
-			$this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret);
61
-		}
51
+    /**
52
+     * Encrypted value of the token. This is used to mitigate BREACH alike
53
+     * vulnerabilities. For display measures do use this functionality.
54
+     *
55
+     * @return string
56
+     */
57
+    public function getEncryptedValue(): string {
58
+        if ($this->encryptedValue === '') {
59
+            $sharedSecret = random_bytes(\strlen($this->value));
60
+            $this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret);
61
+        }
62 62
 
63
-		return $this->encryptedValue;
64
-	}
63
+        return $this->encryptedValue;
64
+    }
65 65
 
66
-	/**
67
-	 * The unencrypted value of the token. Used for decrypting an already
68
-	 * encrypted token.
69
-	 *
70
-	 * @return string
71
-	 */
72
-	public function getDecryptedValue(): string {
73
-		$token = explode(':', $this->value);
74
-		if (\count($token) !== 2) {
75
-			return '';
76
-		}
77
-		$obfuscatedToken = $token[0];
78
-		$secret = $token[1];
79
-		return base64_decode($obfuscatedToken) ^ base64_decode($secret);
80
-	}
66
+    /**
67
+     * The unencrypted value of the token. Used for decrypting an already
68
+     * encrypted token.
69
+     *
70
+     * @return string
71
+     */
72
+    public function getDecryptedValue(): string {
73
+        $token = explode(':', $this->value);
74
+        if (\count($token) !== 2) {
75
+            return '';
76
+        }
77
+        $obfuscatedToken = $token[0];
78
+        $secret = $token[1];
79
+        return base64_decode($obfuscatedToken) ^ base64_decode($secret);
80
+    }
81 81
 }
Please login to merge, or discard this patch.
lib/private/Security/CSRF/TokenStorage/SessionStorage.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -35,59 +35,59 @@
 block discarded – undo
35 35
  * @package OC\Security\CSRF\TokenStorage
36 36
  */
37 37
 class SessionStorage {
38
-	/** @var ISession */
39
-	private $session;
38
+    /** @var ISession */
39
+    private $session;
40 40
 
41
-	/**
42
-	 * @param ISession $session
43
-	 */
44
-	public function __construct(ISession $session) {
45
-		$this->session = $session;
46
-	}
41
+    /**
42
+     * @param ISession $session
43
+     */
44
+    public function __construct(ISession $session) {
45
+        $this->session = $session;
46
+    }
47 47
 
48
-	/**
49
-	 * @param ISession $session
50
-	 */
51
-	public function setSession(ISession $session) {
52
-		$this->session = $session;
53
-	}
48
+    /**
49
+     * @param ISession $session
50
+     */
51
+    public function setSession(ISession $session) {
52
+        $this->session = $session;
53
+    }
54 54
 
55
-	/**
56
-	 * Returns the current token or throws an exception if none is found.
57
-	 *
58
-	 * @return string
59
-	 * @throws \Exception
60
-	 */
61
-	public function getToken(): string {
62
-		$token = $this->session->get('requesttoken');
63
-		if (empty($token)) {
64
-			throw new \Exception('Session does not contain a requesttoken');
65
-		}
55
+    /**
56
+     * Returns the current token or throws an exception if none is found.
57
+     *
58
+     * @return string
59
+     * @throws \Exception
60
+     */
61
+    public function getToken(): string {
62
+        $token = $this->session->get('requesttoken');
63
+        if (empty($token)) {
64
+            throw new \Exception('Session does not contain a requesttoken');
65
+        }
66 66
 
67
-		return $token;
68
-	}
67
+        return $token;
68
+    }
69 69
 
70
-	/**
71
-	 * Set the valid current token to $value.
72
-	 *
73
-	 * @param string $value
74
-	 */
75
-	public function setToken(string $value) {
76
-		$this->session->set('requesttoken', $value);
77
-	}
70
+    /**
71
+     * Set the valid current token to $value.
72
+     *
73
+     * @param string $value
74
+     */
75
+    public function setToken(string $value) {
76
+        $this->session->set('requesttoken', $value);
77
+    }
78 78
 
79
-	/**
80
-	 * Removes the current token.
81
-	 */
82
-	public function removeToken() {
83
-		$this->session->remove('requesttoken');
84
-	}
85
-	/**
86
-	 * Whether the storage has a storage.
87
-	 *
88
-	 * @return bool
89
-	 */
90
-	public function hasToken(): bool {
91
-		return $this->session->exists('requesttoken');
92
-	}
79
+    /**
80
+     * Removes the current token.
81
+     */
82
+    public function removeToken() {
83
+        $this->session->remove('requesttoken');
84
+    }
85
+    /**
86
+     * Whether the storage has a storage.
87
+     *
88
+     * @return bool
89
+     */
90
+    public function hasToken(): bool {
91
+        return $this->session->exists('requesttoken');
92
+    }
93 93
 }
Please login to merge, or discard this patch.
lib/private/Security/CSRF/CsrfTokenManager.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -34,78 +34,78 @@
 block discarded – undo
34 34
  * @package OC\Security\CSRF
35 35
  */
36 36
 class CsrfTokenManager {
37
-	/** @var CsrfTokenGenerator */
38
-	private $tokenGenerator;
39
-	/** @var SessionStorage */
40
-	private $sessionStorage;
41
-	/** @var CsrfToken|null */
42
-	private $csrfToken = null;
37
+    /** @var CsrfTokenGenerator */
38
+    private $tokenGenerator;
39
+    /** @var SessionStorage */
40
+    private $sessionStorage;
41
+    /** @var CsrfToken|null */
42
+    private $csrfToken = null;
43 43
 
44
-	/**
45
-	 * @param CsrfTokenGenerator $tokenGenerator
46
-	 * @param SessionStorage $storageInterface
47
-	 */
48
-	public function __construct(CsrfTokenGenerator $tokenGenerator,
49
-								SessionStorage $storageInterface) {
50
-		$this->tokenGenerator = $tokenGenerator;
51
-		$this->sessionStorage = $storageInterface;
52
-	}
44
+    /**
45
+     * @param CsrfTokenGenerator $tokenGenerator
46
+     * @param SessionStorage $storageInterface
47
+     */
48
+    public function __construct(CsrfTokenGenerator $tokenGenerator,
49
+                                SessionStorage $storageInterface) {
50
+        $this->tokenGenerator = $tokenGenerator;
51
+        $this->sessionStorage = $storageInterface;
52
+    }
53 53
 
54
-	/**
55
-	 * Returns the current CSRF token, if none set it will create a new one.
56
-	 *
57
-	 * @return CsrfToken
58
-	 */
59
-	public function getToken(): CsrfToken {
60
-		if (!\is_null($this->csrfToken)) {
61
-			return $this->csrfToken;
62
-		}
54
+    /**
55
+     * Returns the current CSRF token, if none set it will create a new one.
56
+     *
57
+     * @return CsrfToken
58
+     */
59
+    public function getToken(): CsrfToken {
60
+        if (!\is_null($this->csrfToken)) {
61
+            return $this->csrfToken;
62
+        }
63 63
 
64
-		if ($this->sessionStorage->hasToken()) {
65
-			$value = $this->sessionStorage->getToken();
66
-		} else {
67
-			$value = $this->tokenGenerator->generateToken();
68
-			$this->sessionStorage->setToken($value);
69
-		}
64
+        if ($this->sessionStorage->hasToken()) {
65
+            $value = $this->sessionStorage->getToken();
66
+        } else {
67
+            $value = $this->tokenGenerator->generateToken();
68
+            $this->sessionStorage->setToken($value);
69
+        }
70 70
 
71
-		$this->csrfToken = new CsrfToken($value);
72
-		return $this->csrfToken;
73
-	}
71
+        $this->csrfToken = new CsrfToken($value);
72
+        return $this->csrfToken;
73
+    }
74 74
 
75
-	/**
76
-	 * Invalidates any current token and sets a new one.
77
-	 *
78
-	 * @return CsrfToken
79
-	 */
80
-	public function refreshToken(): CsrfToken {
81
-		$value = $this->tokenGenerator->generateToken();
82
-		$this->sessionStorage->setToken($value);
83
-		$this->csrfToken = new CsrfToken($value);
84
-		return $this->csrfToken;
85
-	}
75
+    /**
76
+     * Invalidates any current token and sets a new one.
77
+     *
78
+     * @return CsrfToken
79
+     */
80
+    public function refreshToken(): CsrfToken {
81
+        $value = $this->tokenGenerator->generateToken();
82
+        $this->sessionStorage->setToken($value);
83
+        $this->csrfToken = new CsrfToken($value);
84
+        return $this->csrfToken;
85
+    }
86 86
 
87
-	/**
88
-	 * Remove the current token from the storage.
89
-	 */
90
-	public function removeToken() {
91
-		$this->csrfToken = null;
92
-		$this->sessionStorage->removeToken();
93
-	}
87
+    /**
88
+     * Remove the current token from the storage.
89
+     */
90
+    public function removeToken() {
91
+        $this->csrfToken = null;
92
+        $this->sessionStorage->removeToken();
93
+    }
94 94
 
95
-	/**
96
-	 * Verifies whether the provided token is valid.
97
-	 *
98
-	 * @param CsrfToken $token
99
-	 * @return bool
100
-	 */
101
-	public function isTokenValid(CsrfToken $token): bool {
102
-		if (!$this->sessionStorage->hasToken()) {
103
-			return false;
104
-		}
95
+    /**
96
+     * Verifies whether the provided token is valid.
97
+     *
98
+     * @param CsrfToken $token
99
+     * @return bool
100
+     */
101
+    public function isTokenValid(CsrfToken $token): bool {
102
+        if (!$this->sessionStorage->hasToken()) {
103
+            return false;
104
+        }
105 105
 
106
-		return hash_equals(
107
-			$this->sessionStorage->getToken(),
108
-			$token->getDecryptedValue()
109
-		);
110
-	}
106
+        return hash_equals(
107
+            $this->sessionStorage->getToken(),
108
+            $token->getDecryptedValue()
109
+        );
110
+    }
111 111
 }
Please login to merge, or discard this patch.
lib/private/Command/QueueBus.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -27,48 +27,48 @@
 block discarded – undo
27 27
 use OCP\Command\ICommand;
28 28
 
29 29
 class QueueBus implements IBus {
30
-	/**
31
-	 * @var ICommand[]|callable[]
32
-	 */
33
-	private $queue = [];
30
+    /**
31
+     * @var ICommand[]|callable[]
32
+     */
33
+    private $queue = [];
34 34
 
35
-	/**
36
-	 * Schedule a command to be fired
37
-	 *
38
-	 * @param \OCP\Command\ICommand | callable $command
39
-	 */
40
-	public function push($command) {
41
-		$this->queue[] = $command;
42
-	}
35
+    /**
36
+     * Schedule a command to be fired
37
+     *
38
+     * @param \OCP\Command\ICommand | callable $command
39
+     */
40
+    public function push($command) {
41
+        $this->queue[] = $command;
42
+    }
43 43
 
44
-	/**
45
-	 * Require all commands using a trait to be run synchronous
46
-	 *
47
-	 * @param string $trait
48
-	 */
49
-	public function requireSync($trait) {
50
-	}
44
+    /**
45
+     * Require all commands using a trait to be run synchronous
46
+     *
47
+     * @param string $trait
48
+     */
49
+    public function requireSync($trait) {
50
+    }
51 51
 
52
-	/**
53
-	 * @param \OCP\Command\ICommand | callable $command
54
-	 */
55
-	private function runCommand($command) {
56
-		if ($command instanceof ICommand) {
57
-			// ensure the command can be serialized
58
-			$serialized = serialize($command);
59
-			if (strlen($serialized) > 4000) {
60
-				throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
61
-			}
62
-			$unserialized = unserialize($serialized);
63
-			$unserialized->handle();
64
-		} else {
65
-			$command();
66
-		}
67
-	}
52
+    /**
53
+     * @param \OCP\Command\ICommand | callable $command
54
+     */
55
+    private function runCommand($command) {
56
+        if ($command instanceof ICommand) {
57
+            // ensure the command can be serialized
58
+            $serialized = serialize($command);
59
+            if (strlen($serialized) > 4000) {
60
+                throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
61
+            }
62
+            $unserialized = unserialize($serialized);
63
+            $unserialized->handle();
64
+        } else {
65
+            $command();
66
+        }
67
+    }
68 68
 
69
-	public function run() {
70
-		while ($command = array_shift($this->queue)) {
71
-			$this->runCommand($command);
72
-		}
73
-	}
69
+    public function run() {
70
+        while ($command = array_shift($this->queue)) {
71
+            $this->runCommand($command);
72
+        }
73
+    }
74 74
 }
Please login to merge, or discard this patch.