Completed
Pull Request — master (#9632)
by Christoph
140:26 queued 107:12
created
lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -35,52 +35,52 @@
 block discarded – undo
35 35
  */
36 36
 class ProviderUserAssignmentDao {
37 37
 
38
-	const TABLE_NAME = 'twofactor_providers';
38
+    const TABLE_NAME = 'twofactor_providers';
39 39
 
40
-	/** @var IDBConnection */
41
-	private $conn;
40
+    /** @var IDBConnection */
41
+    private $conn;
42 42
 
43
-	public function __construct(IDBConnection $dbConn) {
44
-		$this->conn = $dbConn;
45
-	}
43
+    public function __construct(IDBConnection $dbConn) {
44
+        $this->conn = $dbConn;
45
+    }
46 46
 
47
-	/**
48
-	 * Get all assigned provider IDs for the given user ID
49
-	 *
50
-	 * @return string[] where the array key is the provider ID (string) and the
51
-	 *                  value is the enabled state (bool)
52
-	 */
53
-	public function getState(string $uid): array {
54
-		$qb = $this->conn->getQueryBuilder();
47
+    /**
48
+     * Get all assigned provider IDs for the given user ID
49
+     *
50
+     * @return string[] where the array key is the provider ID (string) and the
51
+     *                  value is the enabled state (bool)
52
+     */
53
+    public function getState(string $uid): array {
54
+        $qb = $this->conn->getQueryBuilder();
55 55
 
56
-		$query = $qb->select('provider_id', 'enabled')
57
-			->from(self::TABLE_NAME)
58
-			->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)));
59
-		$result = $query->execute();
60
-		$providers = [];
61
-		foreach ($result->fetchAll() as $row) {
62
-			$providers[$row['provider_id']] = 1 === (int) $row['enabled'];
63
-		}
64
-		$result->closeCursor();
56
+        $query = $qb->select('provider_id', 'enabled')
57
+            ->from(self::TABLE_NAME)
58
+            ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)));
59
+        $result = $query->execute();
60
+        $providers = [];
61
+        foreach ($result->fetchAll() as $row) {
62
+            $providers[$row['provider_id']] = 1 === (int) $row['enabled'];
63
+        }
64
+        $result->closeCursor();
65 65
 
66
-		return $providers;
67
-	}
66
+        return $providers;
67
+    }
68 68
 
69
-	/**
70
-	 * Persist a new/updated (provider_id, uid, enabled) tuple
71
-	 */
72
-	public function persist(string $providerId, string $uid, bool $enabled) {
73
-		$qb = $this->conn->getQueryBuilder();
69
+    /**
70
+     * Persist a new/updated (provider_id, uid, enabled) tuple
71
+     */
72
+    public function persist(string $providerId, string $uid, bool $enabled) {
73
+        $qb = $this->conn->getQueryBuilder();
74 74
 
75
-		// TODO: concurrency? What if (providerId, uid) private key is inserted
76
-		//       twice at the same time?
77
-		$query = $qb->insert(self::TABLE_NAME)->values([
78
-			'provider_id' => $qb->createNamedParameter($providerId),
79
-			'uid' => $qb->createNamedParameter($uid),
80
-			'enabled' => $qb->createNamedParameter($enabled, IQueryBuilder::PARAM_BOOL),
81
-		]);
75
+        // TODO: concurrency? What if (providerId, uid) private key is inserted
76
+        //       twice at the same time?
77
+        $query = $qb->insert(self::TABLE_NAME)->values([
78
+            'provider_id' => $qb->createNamedParameter($providerId),
79
+            'uid' => $qb->createNamedParameter($uid),
80
+            'enabled' => $qb->createNamedParameter($enabled, IQueryBuilder::PARAM_BOOL),
81
+        ]);
82 82
 
83
-		$query->execute();
84
-	}
83
+        $query->execute();
84
+    }
85 85
 
86 86
 }
Please login to merge, or discard this patch.
lib/private/Authentication/TwoFactorAuth/ProviderSet.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -31,41 +31,41 @@
 block discarded – undo
31 31
  */
32 32
 class ProviderSet {
33 33
 
34
-	/** @var IProvider */
35
-	private $providers;
34
+    /** @var IProvider */
35
+    private $providers;
36 36
 
37
-	/** @var bool */
38
-	private $providerMissing;
37
+    /** @var bool */
38
+    private $providerMissing;
39 39
 
40
-	/**
41
-	 * @param IProvider[] $providers
42
-	 * @param bool $providerMissing
43
-	 */
44
-	public function __construct(array $providers, bool $providerMissing) {
45
-		$this->providers = [];
46
-		foreach ($providers as $provider) {
47
-			$this->providers[$provider->getId()] = $provider;
48
-		}
49
-		$this->providerMissing = $providerMissing;
50
-	}
40
+    /**
41
+     * @param IProvider[] $providers
42
+     * @param bool $providerMissing
43
+     */
44
+    public function __construct(array $providers, bool $providerMissing) {
45
+        $this->providers = [];
46
+        foreach ($providers as $provider) {
47
+            $this->providers[$provider->getId()] = $provider;
48
+        }
49
+        $this->providerMissing = $providerMissing;
50
+    }
51 51
 
52
-	/**
53
-	 * @param string $providerId
54
-	 * @return IProvider|null
55
-	 */
56
-	public function getProvider(string $providerId) {
57
-		return $this->providers[$providerId] ?? null;
58
-	}
52
+    /**
53
+     * @param string $providerId
54
+     * @return IProvider|null
55
+     */
56
+    public function getProvider(string $providerId) {
57
+        return $this->providers[$providerId] ?? null;
58
+    }
59 59
 
60
-	/**
61
-	 * @return IProvider[]
62
-	 */
63
-	public function getProviders(): array {
64
-		return $this->providers;
65
-	}
60
+    /**
61
+     * @return IProvider[]
62
+     */
63
+    public function getProviders(): array {
64
+        return $this->providers;
65
+    }
66 66
 
67
-	public function isProviderMissing(): bool {
68
-		return $this->providerMissing;
69
-	}
67
+    public function isProviderMissing(): bool {
68
+        return $this->providerMissing;
69
+    }
70 70
 
71 71
 }
Please login to merge, or discard this patch.