Completed
Pull Request — master (#9632)
by Christoph
61:25 queued 37:02
created
lib/private/Authentication/TwoFactorAuth/Registry.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,23 +33,23 @@
 block discarded – undo
33 33
 
34 34
 class Registry implements IRegistry {
35 35
 
36
-	/** @var ProviderUserAssignmentDao */
37
-	private $assignmentDao;
36
+    /** @var ProviderUserAssignmentDao */
37
+    private $assignmentDao;
38 38
 
39
-	public function __construct(ProviderUserAssignmentDao $assignmentDao) {
40
-		$this->assignmentDao = $assignmentDao;
41
-	}
39
+    public function __construct(ProviderUserAssignmentDao $assignmentDao) {
40
+        $this->assignmentDao = $assignmentDao;
41
+    }
42 42
 
43
-	public function getProviderStates(IUser $user): array {
44
-		return $this->assignmentDao->getState($user->getUID());
45
-	}
43
+    public function getProviderStates(IUser $user): array {
44
+        return $this->assignmentDao->getState($user->getUID());
45
+    }
46 46
 
47
-	public function enableProviderFor(IProvider $provider, IUser $user) {
48
-		$this->assignmentDao->persist($provider->getId(), $user->getUID(), 1);
49
-	}
47
+    public function enableProviderFor(IProvider $provider, IUser $user) {
48
+        $this->assignmentDao->persist($provider->getId(), $user->getUID(), 1);
49
+    }
50 50
 
51
-	public function disableProviderFor(IProvider $provider, IUser $user) {
52
-		$this->assignmentDao->persist($provider->getId(), $user->getUID(), 0);
53
-	}
51
+    public function disableProviderFor(IProvider $provider, IUser $user) {
52
+        $this->assignmentDao->persist($provider->getId(), $user->getUID(), 0);
53
+    }
54 54
 
55 55
 }
Please login to merge, or discard this patch.
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, int $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, int $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_INT),
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_INT),
81
+        ]);
82 82
 
83
-		$query->execute();
84
-	}
83
+        $query->execute();
84
+    }
85 85
 
86 86
 }
Please login to merge, or discard this patch.