Passed
Push — master ( 076f6b...c1ddd2 )
by Morris
15:36 queued 04:46
created
apps/user_ldap/lib/User/DeletedUsersIndex.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -31,90 +31,90 @@
 block discarded – undo
31 31
  * @package OCA\User_LDAP
32 32
  */
33 33
 class DeletedUsersIndex {
34
-	/**
35
-	 * @var \OCP\IConfig $config
36
-	 */
37
-	protected $config;
34
+    /**
35
+     * @var \OCP\IConfig $config
36
+     */
37
+    protected $config;
38 38
 
39
-	/**
40
-	 * @var \OCP\IDBConnection $db
41
-	 */
42
-	protected $db;
39
+    /**
40
+     * @var \OCP\IDBConnection $db
41
+     */
42
+    protected $db;
43 43
 
44
-	/**
45
-	 * @var \OCA\User_LDAP\Mapping\UserMapping $mapping
46
-	 */
47
-	protected $mapping;
44
+    /**
45
+     * @var \OCA\User_LDAP\Mapping\UserMapping $mapping
46
+     */
47
+    protected $mapping;
48 48
 
49
-	/**
50
-	 * @var array $deletedUsers
51
-	 */
52
-	protected $deletedUsers;
49
+    /**
50
+     * @var array $deletedUsers
51
+     */
52
+    protected $deletedUsers;
53 53
 
54
-	/**
55
-	 * @param \OCP\IConfig $config
56
-	 * @param \OCP\IDBConnection $db
57
-	 * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
58
-	 */
59
-	public function __construct(\OCP\IConfig $config, \OCP\IDBConnection $db, UserMapping $mapping) {
60
-		$this->config = $config;
61
-		$this->db = $db;
62
-		$this->mapping = $mapping;
63
-	}
54
+    /**
55
+     * @param \OCP\IConfig $config
56
+     * @param \OCP\IDBConnection $db
57
+     * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
58
+     */
59
+    public function __construct(\OCP\IConfig $config, \OCP\IDBConnection $db, UserMapping $mapping) {
60
+        $this->config = $config;
61
+        $this->db = $db;
62
+        $this->mapping = $mapping;
63
+    }
64 64
 
65
-	/**
66
-	 * reads LDAP users marked as deleted from the database
67
-	 * @return \OCA\User_LDAP\User\OfflineUser[]
68
-	 */
69
-	private function fetchDeletedUsers() {
70
-		$deletedUsers = $this->config->getUsersForUserValue(
71
-			'user_ldap', 'isDeleted', '1');
65
+    /**
66
+     * reads LDAP users marked as deleted from the database
67
+     * @return \OCA\User_LDAP\User\OfflineUser[]
68
+     */
69
+    private function fetchDeletedUsers() {
70
+        $deletedUsers = $this->config->getUsersForUserValue(
71
+            'user_ldap', 'isDeleted', '1');
72 72
 
73
-		$userObjects = [];
74
-		foreach($deletedUsers as $user) {
75
-			$userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
76
-		}
77
-		$this->deletedUsers = $userObjects;
73
+        $userObjects = [];
74
+        foreach($deletedUsers as $user) {
75
+            $userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
76
+        }
77
+        $this->deletedUsers = $userObjects;
78 78
 
79
-		return $this->deletedUsers;
80
-	}
79
+        return $this->deletedUsers;
80
+    }
81 81
 
82
-	/**
83
-	 * returns all LDAP users that are marked as deleted
84
-	 * @return \OCA\User_LDAP\User\OfflineUser[]
85
-	 */
86
-	public function getUsers() {
87
-		if(is_array($this->deletedUsers)) {
88
-			return $this->deletedUsers;
89
-		}
90
-		return $this->fetchDeletedUsers();
91
-	}
82
+    /**
83
+     * returns all LDAP users that are marked as deleted
84
+     * @return \OCA\User_LDAP\User\OfflineUser[]
85
+     */
86
+    public function getUsers() {
87
+        if(is_array($this->deletedUsers)) {
88
+            return $this->deletedUsers;
89
+        }
90
+        return $this->fetchDeletedUsers();
91
+    }
92 92
 
93
-	/**
94
-	 * whether at least one user was detected as deleted
95
-	 * @return bool
96
-	 */
97
-	public function hasUsers() {
98
-		if(!is_array($this->deletedUsers)) {
99
-			$this->fetchDeletedUsers();
100
-		}
101
-		return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0);
102
-	}
93
+    /**
94
+     * whether at least one user was detected as deleted
95
+     * @return bool
96
+     */
97
+    public function hasUsers() {
98
+        if(!is_array($this->deletedUsers)) {
99
+            $this->fetchDeletedUsers();
100
+        }
101
+        return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0);
102
+    }
103 103
 
104
-	/**
105
-	 * marks a user as deleted
106
-	 *
107
-	 * @param string $ocName
108
-	 * @throws \OCP\PreConditionNotMetException
109
-	 */
110
-	public function markUser($ocName) {
111
-		$curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0');
112
-		if($curValue === '1') {
113
-			// the user is already marked, do not write to DB again
114
-			return;
115
-		}
116
-		$this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1');
117
-		$this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time());
118
-		$this->deletedUsers = null;
119
-	}
104
+    /**
105
+     * marks a user as deleted
106
+     *
107
+     * @param string $ocName
108
+     * @throws \OCP\PreConditionNotMetException
109
+     */
110
+    public function markUser($ocName) {
111
+        $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0');
112
+        if($curValue === '1') {
113
+            // the user is already marked, do not write to DB again
114
+            return;
115
+        }
116
+        $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1');
117
+        $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time());
118
+        $this->deletedUsers = null;
119
+    }
120 120
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			'user_ldap', 'isDeleted', '1');
72 72
 
73 73
 		$userObjects = [];
74
-		foreach($deletedUsers as $user) {
74
+		foreach ($deletedUsers as $user) {
75 75
 			$userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
76 76
 		}
77 77
 		$this->deletedUsers = $userObjects;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @return \OCA\User_LDAP\User\OfflineUser[]
85 85
 	 */
86 86
 	public function getUsers() {
87
-		if(is_array($this->deletedUsers)) {
87
+		if (is_array($this->deletedUsers)) {
88 88
 			return $this->deletedUsers;
89 89
 		}
90 90
 		return $this->fetchDeletedUsers();
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return bool
96 96
 	 */
97 97
 	public function hasUsers() {
98
-		if(!is_array($this->deletedUsers)) {
98
+		if (!is_array($this->deletedUsers)) {
99 99
 			$this->fetchDeletedUsers();
100 100
 		}
101 101
 		return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0);
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function markUser($ocName) {
111 111
 		$curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0');
112
-		if($curValue === '1') {
112
+		if ($curValue === '1') {
113 113
 			// the user is already marked, do not write to DB again
114 114
 			return;
115 115
 		}
116 116
 		$this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1');
117
-		$this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time());
117
+		$this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string) time());
118 118
 		$this->deletedUsers = null;
119 119
 	}
120 120
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/User/OfflineUser.php 2 patches
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -29,219 +29,219 @@
 block discarded – undo
29 29
 use OCP\IDBConnection;
30 30
 
31 31
 class OfflineUser {
32
-	/**
33
-	 * @var string $ocName
34
-	 */
35
-	protected $ocName;
36
-	/**
37
-	 * @var string $dn
38
-	 */
39
-	protected $dn;
40
-	/**
41
-	 * @var string $uid the UID as provided by LDAP
42
-	 */
43
-	protected $uid;
44
-	/**
45
-	 * @var string $displayName
46
-	 */
47
-	protected $displayName;
48
-	/**
49
-	 * @var string $homePath
50
-	 */
51
-	protected $homePath;
52
-	/**
53
-	 * @var string $lastLogin the timestamp of the last login
54
-	 */
55
-	protected $lastLogin;
56
-	/**
57
-	 * @var string $foundDeleted the timestamp when the user was detected as unavailable
58
-	 */
59
-	protected $foundDeleted;
60
-	/**
61
-	 * @var string $email
62
-	 */
63
-	protected $email;
64
-	/**
65
-	 * @var bool $hasActiveShares
66
-	 */
67
-	protected $hasActiveShares;
68
-	/**
69
-	 * @var IConfig $config
70
-	 */
71
-	protected $config;
72
-	/**
73
-	 * @var IDBConnection $db
74
-	 */
75
-	protected $db;
76
-	/**
77
-	 * @var \OCA\User_LDAP\Mapping\UserMapping
78
-	 */
79
-	protected $mapping;
80
-
81
-	/**
82
-	 * @param string $ocName
83
-	 * @param IConfig $config
84
-	 * @param IDBConnection $db
85
-	 * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
86
-	 */
87
-	public function __construct($ocName, IConfig $config, IDBConnection $db, UserMapping $mapping) {
88
-		$this->ocName = $ocName;
89
-		$this->config = $config;
90
-		$this->db = $db;
91
-		$this->mapping = $mapping;
92
-		$this->fetchDetails();
93
-	}
94
-
95
-	/**
96
-	 * remove the Delete-flag from the user.
97
-	 */
98
-	public function unmark() {
99
-		$this->config->deleteUserValue($this->ocName, 'user_ldap', 'isDeleted');
100
-		$this->config->deleteUserValue($this->ocName, 'user_ldap', 'foundDeleted');
101
-	}
102
-
103
-	/**
104
-	 * exports the user details in an assoc array
105
-	 * @return array
106
-	 */
107
-	public function export() {
108
-		$data = array();
109
-		$data['ocName'] = $this->getOCName();
110
-		$data['dn'] = $this->getDN();
111
-		$data['uid'] = $this->getUID();
112
-		$data['displayName'] = $this->getDisplayName();
113
-		$data['homePath'] = $this->getHomePath();
114
-		$data['lastLogin'] = $this->getLastLogin();
115
-		$data['email'] = $this->getEmail();
116
-		$data['hasActiveShares'] = $this->getHasActiveShares();
117
-
118
-		return $data;
119
-	}
120
-
121
-	/**
122
-	 * getter for Nextcloud internal name
123
-	 * @return string
124
-	 */
125
-	public function getOCName() {
126
-		return $this->ocName;
127
-	}
128
-
129
-	/**
130
-	 * getter for LDAP uid
131
-	 * @return string
132
-	 */
133
-	public function getUID() {
134
-		return $this->uid;
135
-	}
136
-
137
-	/**
138
-	 * getter for LDAP DN
139
-	 * @return string
140
-	 */
141
-	public function getDN() {
142
-		return $this->dn;
143
-	}
144
-
145
-	/**
146
-	 * getter for display name
147
-	 * @return string
148
-	 */
149
-	public function getDisplayName() {
150
-		return $this->displayName;
151
-	}
152
-
153
-	/**
154
-	 * getter for email
155
-	 * @return string
156
-	 */
157
-	public function getEmail() {
158
-		return $this->email;
159
-	}
160
-
161
-	/**
162
-	 * getter for home directory path
163
-	 * @return string
164
-	 */
165
-	public function getHomePath() {
166
-		return $this->homePath;
167
-	}
168
-
169
-	/**
170
-	 * getter for the last login timestamp
171
-	 * @return int
172
-	 */
173
-	public function getLastLogin() {
174
-		return (int)$this->lastLogin;
175
-	}
176
-
177
-	/**
178
-	 * getter for the detection timestamp
179
-	 * @return int
180
-	 */
181
-	public function getDetectedOn() {
182
-		return (int)$this->foundDeleted;
183
-	}
184
-
185
-	/**
186
-	 * getter for having active shares
187
-	 * @return bool
188
-	 */
189
-	public function getHasActiveShares() {
190
-		return $this->hasActiveShares;
191
-	}
192
-
193
-	/**
194
-	 * reads the user details
195
-	 */
196
-	protected function fetchDetails() {
197
-		$properties = [
198
-			'displayName'  => 'user_ldap',
199
-			'uid'          => 'user_ldap',
200
-			'homePath'     => 'user_ldap',
201
-			'foundDeleted' => 'user_ldap',
202
-			'email'        => 'settings',
203
-			'lastLogin'    => 'login',
204
-		];
205
-		foreach($properties as $property => $app) {
206
-			$this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
207
-		}
208
-
209
-		$dn = $this->mapping->getDNByName($this->ocName);
210
-		$this->dn = ($dn !== false) ? $dn : '';
211
-
212
-		$this->determineShares();
213
-	}
214
-
215
-
216
-	/**
217
-	 * finds out whether the user has active shares. The result is stored in
218
-	 * $this->hasActiveShares
219
-	 */
220
-	protected function determineShares() {
221
-		$query = $this->db->prepare('
32
+    /**
33
+     * @var string $ocName
34
+     */
35
+    protected $ocName;
36
+    /**
37
+     * @var string $dn
38
+     */
39
+    protected $dn;
40
+    /**
41
+     * @var string $uid the UID as provided by LDAP
42
+     */
43
+    protected $uid;
44
+    /**
45
+     * @var string $displayName
46
+     */
47
+    protected $displayName;
48
+    /**
49
+     * @var string $homePath
50
+     */
51
+    protected $homePath;
52
+    /**
53
+     * @var string $lastLogin the timestamp of the last login
54
+     */
55
+    protected $lastLogin;
56
+    /**
57
+     * @var string $foundDeleted the timestamp when the user was detected as unavailable
58
+     */
59
+    protected $foundDeleted;
60
+    /**
61
+     * @var string $email
62
+     */
63
+    protected $email;
64
+    /**
65
+     * @var bool $hasActiveShares
66
+     */
67
+    protected $hasActiveShares;
68
+    /**
69
+     * @var IConfig $config
70
+     */
71
+    protected $config;
72
+    /**
73
+     * @var IDBConnection $db
74
+     */
75
+    protected $db;
76
+    /**
77
+     * @var \OCA\User_LDAP\Mapping\UserMapping
78
+     */
79
+    protected $mapping;
80
+
81
+    /**
82
+     * @param string $ocName
83
+     * @param IConfig $config
84
+     * @param IDBConnection $db
85
+     * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
86
+     */
87
+    public function __construct($ocName, IConfig $config, IDBConnection $db, UserMapping $mapping) {
88
+        $this->ocName = $ocName;
89
+        $this->config = $config;
90
+        $this->db = $db;
91
+        $this->mapping = $mapping;
92
+        $this->fetchDetails();
93
+    }
94
+
95
+    /**
96
+     * remove the Delete-flag from the user.
97
+     */
98
+    public function unmark() {
99
+        $this->config->deleteUserValue($this->ocName, 'user_ldap', 'isDeleted');
100
+        $this->config->deleteUserValue($this->ocName, 'user_ldap', 'foundDeleted');
101
+    }
102
+
103
+    /**
104
+     * exports the user details in an assoc array
105
+     * @return array
106
+     */
107
+    public function export() {
108
+        $data = array();
109
+        $data['ocName'] = $this->getOCName();
110
+        $data['dn'] = $this->getDN();
111
+        $data['uid'] = $this->getUID();
112
+        $data['displayName'] = $this->getDisplayName();
113
+        $data['homePath'] = $this->getHomePath();
114
+        $data['lastLogin'] = $this->getLastLogin();
115
+        $data['email'] = $this->getEmail();
116
+        $data['hasActiveShares'] = $this->getHasActiveShares();
117
+
118
+        return $data;
119
+    }
120
+
121
+    /**
122
+     * getter for Nextcloud internal name
123
+     * @return string
124
+     */
125
+    public function getOCName() {
126
+        return $this->ocName;
127
+    }
128
+
129
+    /**
130
+     * getter for LDAP uid
131
+     * @return string
132
+     */
133
+    public function getUID() {
134
+        return $this->uid;
135
+    }
136
+
137
+    /**
138
+     * getter for LDAP DN
139
+     * @return string
140
+     */
141
+    public function getDN() {
142
+        return $this->dn;
143
+    }
144
+
145
+    /**
146
+     * getter for display name
147
+     * @return string
148
+     */
149
+    public function getDisplayName() {
150
+        return $this->displayName;
151
+    }
152
+
153
+    /**
154
+     * getter for email
155
+     * @return string
156
+     */
157
+    public function getEmail() {
158
+        return $this->email;
159
+    }
160
+
161
+    /**
162
+     * getter for home directory path
163
+     * @return string
164
+     */
165
+    public function getHomePath() {
166
+        return $this->homePath;
167
+    }
168
+
169
+    /**
170
+     * getter for the last login timestamp
171
+     * @return int
172
+     */
173
+    public function getLastLogin() {
174
+        return (int)$this->lastLogin;
175
+    }
176
+
177
+    /**
178
+     * getter for the detection timestamp
179
+     * @return int
180
+     */
181
+    public function getDetectedOn() {
182
+        return (int)$this->foundDeleted;
183
+    }
184
+
185
+    /**
186
+     * getter for having active shares
187
+     * @return bool
188
+     */
189
+    public function getHasActiveShares() {
190
+        return $this->hasActiveShares;
191
+    }
192
+
193
+    /**
194
+     * reads the user details
195
+     */
196
+    protected function fetchDetails() {
197
+        $properties = [
198
+            'displayName'  => 'user_ldap',
199
+            'uid'          => 'user_ldap',
200
+            'homePath'     => 'user_ldap',
201
+            'foundDeleted' => 'user_ldap',
202
+            'email'        => 'settings',
203
+            'lastLogin'    => 'login',
204
+        ];
205
+        foreach($properties as $property => $app) {
206
+            $this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
207
+        }
208
+
209
+        $dn = $this->mapping->getDNByName($this->ocName);
210
+        $this->dn = ($dn !== false) ? $dn : '';
211
+
212
+        $this->determineShares();
213
+    }
214
+
215
+
216
+    /**
217
+     * finds out whether the user has active shares. The result is stored in
218
+     * $this->hasActiveShares
219
+     */
220
+    protected function determineShares() {
221
+        $query = $this->db->prepare('
222 222
 			SELECT COUNT(`uid_owner`)
223 223
 			FROM `*PREFIX*share`
224 224
 			WHERE `uid_owner` = ?
225 225
 		', 1);
226
-		$query->execute(array($this->ocName));
227
-		$sResult = $query->fetchColumn(0);
228
-		if((int)$sResult === 1) {
229
-			$this->hasActiveShares = true;
230
-			return;
231
-		}
232
-
233
-		$query = $this->db->prepare('
226
+        $query->execute(array($this->ocName));
227
+        $sResult = $query->fetchColumn(0);
228
+        if((int)$sResult === 1) {
229
+            $this->hasActiveShares = true;
230
+            return;
231
+        }
232
+
233
+        $query = $this->db->prepare('
234 234
 			SELECT COUNT(`owner`)
235 235
 			FROM `*PREFIX*share_external`
236 236
 			WHERE `owner` = ?
237 237
 		', 1);
238
-		$query->execute(array($this->ocName));
239
-		$sResult = $query->fetchColumn(0);
240
-		if((int)$sResult === 1) {
241
-			$this->hasActiveShares = true;
242
-			return;
243
-		}
244
-
245
-		$this->hasActiveShares = false;
246
-	}
238
+        $query->execute(array($this->ocName));
239
+        $sResult = $query->fetchColumn(0);
240
+        if((int)$sResult === 1) {
241
+            $this->hasActiveShares = true;
242
+            return;
243
+        }
244
+
245
+        $this->hasActiveShares = false;
246
+    }
247 247
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @return int
172 172
 	 */
173 173
 	public function getLastLogin() {
174
-		return (int)$this->lastLogin;
174
+		return (int) $this->lastLogin;
175 175
 	}
176 176
 
177 177
 	/**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @return int
180 180
 	 */
181 181
 	public function getDetectedOn() {
182
-		return (int)$this->foundDeleted;
182
+		return (int) $this->foundDeleted;
183 183
 	}
184 184
 
185 185
 	/**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			'email'        => 'settings',
203 203
 			'lastLogin'    => 'login',
204 204
 		];
205
-		foreach($properties as $property => $app) {
205
+		foreach ($properties as $property => $app) {
206 206
 			$this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
207 207
 		}
208 208
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		', 1);
226 226
 		$query->execute(array($this->ocName));
227 227
 		$sResult = $query->fetchColumn(0);
228
-		if((int)$sResult === 1) {
228
+		if ((int) $sResult === 1) {
229 229
 			$this->hasActiveShares = true;
230 230
 			return;
231 231
 		}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		', 1);
238 238
 		$query->execute(array($this->ocName));
239 239
 		$sResult = $query->fetchColumn(0);
240
-		if((int)$sResult === 1) {
240
+		if ((int) $sResult === 1) {
241 241
 			$this->hasActiveShares = true;
242 242
 			return;
243 243
 		}
Please login to merge, or discard this patch.
apps/user_ldap/lib/Command/ShowRemnants.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -35,72 +35,72 @@
 block discarded – undo
35 35
 use OCP\IDateTimeFormatter;
36 36
 
37 37
 class ShowRemnants extends Command {
38
-	/** @var \OCA\User_LDAP\User\DeletedUsersIndex */
39
-	protected $dui;
38
+    /** @var \OCA\User_LDAP\User\DeletedUsersIndex */
39
+    protected $dui;
40 40
 
41
-	/** @var \OCP\IDateTimeFormatter */
42
-	protected $dateFormatter;
41
+    /** @var \OCP\IDateTimeFormatter */
42
+    protected $dateFormatter;
43 43
 
44
-	/**
45
-	 * @param DeletedUsersIndex $dui
46
-	 * @param IDateTimeFormatter $dateFormatter
47
-	 */
48
-	public function __construct(DeletedUsersIndex $dui, IDateTimeFormatter $dateFormatter) {
49
-		$this->dui = $dui;
50
-		$this->dateFormatter = $dateFormatter;
51
-		parent::__construct();
52
-	}
44
+    /**
45
+     * @param DeletedUsersIndex $dui
46
+     * @param IDateTimeFormatter $dateFormatter
47
+     */
48
+    public function __construct(DeletedUsersIndex $dui, IDateTimeFormatter $dateFormatter) {
49
+        $this->dui = $dui;
50
+        $this->dateFormatter = $dateFormatter;
51
+        parent::__construct();
52
+    }
53 53
 
54
-	protected function configure() {
55
-		$this
56
-			->setName('ldap:show-remnants')
57
-			->setDescription('shows which users are not available on LDAP anymore, but have remnants in Nextcloud.')
58
-			->addOption('json', null, InputOption::VALUE_NONE, 'return JSON array instead of pretty table.')
59
-			->addOption('short-date', null, InputOption::VALUE_NONE, 'show dates in Y-m-d format');
60
-	}
54
+    protected function configure() {
55
+        $this
56
+            ->setName('ldap:show-remnants')
57
+            ->setDescription('shows which users are not available on LDAP anymore, but have remnants in Nextcloud.')
58
+            ->addOption('json', null, InputOption::VALUE_NONE, 'return JSON array instead of pretty table.')
59
+            ->addOption('short-date', null, InputOption::VALUE_NONE, 'show dates in Y-m-d format');
60
+    }
61 61
 
62
-	protected function formatDate(int $timestamp, string $default, bool $showShortDate) {
63
-		if (!($timestamp > 0)) {
64
-			return $default;
65
-		}
66
-		if ($showShortDate) {
67
-			return date('Y-m-d', $timestamp);
68
-		}
69
-		return $this->dateFormatter->formatDate($timestamp);
70
-	}
62
+    protected function formatDate(int $timestamp, string $default, bool $showShortDate) {
63
+        if (!($timestamp > 0)) {
64
+            return $default;
65
+        }
66
+        if ($showShortDate) {
67
+            return date('Y-m-d', $timestamp);
68
+        }
69
+        return $this->dateFormatter->formatDate($timestamp);
70
+    }
71 71
 
72
-	/**
73
-	 * executes the command, i.e. creates and outputs a table of LDAP users marked as deleted
74
-	 *
75
-	 * {@inheritdoc}
76
-	 */
77
-	protected function execute(InputInterface $input, OutputInterface $output) {
78
-		/** @var \Symfony\Component\Console\Helper\Table $table */
79
-		$table = new Table($output);
80
-		$table->setHeaders([
81
-			'Nextcloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login',
82
-			'Detected on', 'Dir', 'Sharer'
83
-		]);
84
-		$rows = [];
85
-		$resultSet = $this->dui->getUsers();
86
-		foreach ($resultSet as $user) {
87
-			$rows[] = [
88
-				'ocName' => $user->getOCName(),
89
-				'displayName' => $user->getDisplayName(),
90
-				'uid' => $user->getUID(),
91
-				'dn' => $user->getDN(),
92
-				'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')),
93
-				'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')),
94
-				'homePath' => $user->getHomePath(),
95
-				'sharer' => $user->getHasActiveShares() ? 'Y' : 'N',
96
-			];
97
-		}
72
+    /**
73
+     * executes the command, i.e. creates and outputs a table of LDAP users marked as deleted
74
+     *
75
+     * {@inheritdoc}
76
+     */
77
+    protected function execute(InputInterface $input, OutputInterface $output) {
78
+        /** @var \Symfony\Component\Console\Helper\Table $table */
79
+        $table = new Table($output);
80
+        $table->setHeaders([
81
+            'Nextcloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login',
82
+            'Detected on', 'Dir', 'Sharer'
83
+        ]);
84
+        $rows = [];
85
+        $resultSet = $this->dui->getUsers();
86
+        foreach ($resultSet as $user) {
87
+            $rows[] = [
88
+                'ocName' => $user->getOCName(),
89
+                'displayName' => $user->getDisplayName(),
90
+                'uid' => $user->getUID(),
91
+                'dn' => $user->getDN(),
92
+                'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')),
93
+                'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')),
94
+                'homePath' => $user->getHomePath(),
95
+                'sharer' => $user->getHasActiveShares() ? 'Y' : 'N',
96
+            ];
97
+        }
98 98
 
99
-		if ($input->getOption('json')) {
100
-			$output->writeln(json_encode($rows));
101
-		} else {
102
-			$table->setRows($rows);
103
-			$table->render($output);
104
-		}
105
-	}
99
+        if ($input->getOption('json')) {
100
+            $output->writeln(json_encode($rows));
101
+        } else {
102
+            $table->setRows($rows);
103
+            $table->render($output);
104
+        }
105
+    }
106 106
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@
 block discarded – undo
89 89
 				'displayName' => $user->getDisplayName(),
90 90
 				'uid' => $user->getUID(),
91 91
 				'dn' => $user->getDN(),
92
-				'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')),
93
-				'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')),
92
+				'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool) $input->getOption('short-date')),
93
+				'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool) $input->getOption('short-date')),
94 94
 				'homePath' => $user->getHomePath(),
95 95
 				'sharer' => $user->getHasActiveShares() ? 'Y' : 'N',
96 96
 			];
Please login to merge, or discard this patch.