Skip to content

Commit caff102

Browse files
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent edf8ce3 commit caff102

1,757 files changed

Lines changed: 3872 additions & 5891 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/accessibility/lib/AccessibilityProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,4 @@ public function getFonts() {
9191
]
9292
];
9393
}
94-
9594
}

apps/accessibility/lib/Controller/ConfigController.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ public function getConfig(): DataResponse {
107107
*/
108108
public function setConfig(string $key, $value): DataResponse {
109109
if ($key === 'theme' || $key === 'font' || $key === 'highcontrast') {
110-
111110
if ($value === false || $value === '') {
112111
throw new OCSBadRequestException('Invalid value: ' . $value);
113112
}
@@ -142,7 +141,6 @@ public function setConfig(string $key, $value): DataResponse {
142141
*/
143142
public function deleteConfig(string $key): DataResponse {
144143
if ($key === 'theme' || $key === 'font' || $key === 'highcontrast') {
145-
146144
$this->config->deleteUserValue($this->userId, $this->appName, $key);
147145
$userValues = $this->config->getUserKeys($this->userId, $this->appName);
148146

@@ -156,5 +154,4 @@ public function deleteConfig(string $key): DataResponse {
156154

157155
throw new OCSBadRequestException('Invalid key: ' . $key);
158156
}
159-
160157
}

apps/accessibility/lib/Migration/RepairUserConfig.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,4 @@ public function run(IOutput $output) {
8686
});
8787
$output->finishProgress();
8888
}
89-
9089
}

apps/admin_audit/lib/Actions/Action.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function log(string $text,
5353
array $params,
5454
array $elements,
5555
bool $obfuscateParameters = false) {
56-
foreach($elements as $element) {
57-
if(!isset($params[$element])) {
56+
foreach ($elements as $element) {
57+
if (!isset($params[$element])) {
5858
if ($obfuscateParameters) {
5959
$this->logger->critical(
6060
'$params["'.$element.'"] was missing.',
@@ -74,8 +74,8 @@ public function log(string $text,
7474
}
7575

7676
$replaceArray = [];
77-
foreach($elements as $element) {
78-
if($params[$element] instanceof \DateTime) {
77+
foreach ($elements as $element) {
78+
if ($params[$element] instanceof \DateTime) {
7979
$params[$element] = $params[$element]->format('Y-m-d H:i:s');
8080
}
8181
$replaceArray[] = $params[$element];

apps/admin_audit/lib/Actions/Sharing.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Sharing extends Action {
4343
* @param array $params
4444
*/
4545
public function shared(array $params) {
46-
if($params['shareType'] === Share::SHARE_TYPE_LINK) {
46+
if ($params['shareType'] === Share::SHARE_TYPE_LINK) {
4747
$this->log(
4848
'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)',
4949
$params,
@@ -55,7 +55,7 @@ public function shared(array $params) {
5555
'id',
5656
]
5757
);
58-
} elseif($params['shareType'] === Share::SHARE_TYPE_USER) {
58+
} elseif ($params['shareType'] === Share::SHARE_TYPE_USER) {
5959
$this->log(
6060
'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)',
6161
$params,
@@ -68,7 +68,7 @@ public function shared(array $params) {
6868
'id',
6969
]
7070
);
71-
} elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) {
71+
} elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) {
7272
$this->log(
7373
'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)',
7474
$params,
@@ -81,7 +81,7 @@ public function shared(array $params) {
8181
'id',
8282
]
8383
);
84-
} elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) {
84+
} elseif ($params['shareType'] === Share::SHARE_TYPE_ROOM) {
8585
$this->log(
8686
'The %s "%s" with ID "%s" has been shared to the room "%s" with permissions "%s" (Share ID: %s)',
8787
$params,
@@ -94,7 +94,7 @@ public function shared(array $params) {
9494
'id',
9595
]
9696
);
97-
} elseif($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
97+
} elseif ($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
9898
$this->log(
9999
'The %s "%s" with ID "%s" has been shared to the email recipient "%s" with permissions "%s" (Share ID: %s)',
100100
$params,
@@ -107,7 +107,7 @@ public function shared(array $params) {
107107
'id',
108108
]
109109
);
110-
} elseif($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
110+
} elseif ($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
111111
$this->log(
112112
'The %s "%s" with ID "%s" has been shared to the circle "%s" with permissions "%s" (Share ID: %s)',
113113
$params,
@@ -120,7 +120,7 @@ public function shared(array $params) {
120120
'id',
121121
]
122122
);
123-
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
123+
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
124124
$this->log(
125125
'The %s "%s" with ID "%s" has been shared to the remote user "%s" with permissions "%s" (Share ID: %s)',
126126
$params,
@@ -133,7 +133,7 @@ public function shared(array $params) {
133133
'id',
134134
]
135135
);
136-
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
136+
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
137137
$this->log(
138138
'The %s "%s" with ID "%s" has been shared to the remote group "%s" with permissions "%s" (Share ID: %s)',
139139
$params,
@@ -155,7 +155,7 @@ public function shared(array $params) {
155155
* @param array $params
156156
*/
157157
public function unshare(array $params) {
158-
if($params['shareType'] === Share::SHARE_TYPE_LINK) {
158+
if ($params['shareType'] === Share::SHARE_TYPE_LINK) {
159159
$this->log(
160160
'The %s "%s" with ID "%s" has been unshared (Share ID: %s)',
161161
$params,
@@ -166,7 +166,7 @@ public function unshare(array $params) {
166166
'id',
167167
]
168168
);
169-
} elseif($params['shareType'] === Share::SHARE_TYPE_USER) {
169+
} elseif ($params['shareType'] === Share::SHARE_TYPE_USER) {
170170
$this->log(
171171
'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)',
172172
$params,
@@ -178,7 +178,7 @@ public function unshare(array $params) {
178178
'id',
179179
]
180180
);
181-
} elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) {
181+
} elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) {
182182
$this->log(
183183
'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)',
184184
$params,
@@ -190,7 +190,7 @@ public function unshare(array $params) {
190190
'id',
191191
]
192192
);
193-
} elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) {
193+
} elseif ($params['shareType'] === Share::SHARE_TYPE_ROOM) {
194194
$this->log(
195195
'The %s "%s" with ID "%s" has been unshared from the room "%s" (Share ID: %s)',
196196
$params,
@@ -202,7 +202,7 @@ public function unshare(array $params) {
202202
'id',
203203
]
204204
);
205-
} elseif($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
205+
} elseif ($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
206206
$this->log(
207207
'The %s "%s" with ID "%s" has been unshared from the email recipient "%s" (Share ID: %s)',
208208
$params,
@@ -214,7 +214,7 @@ public function unshare(array $params) {
214214
'id',
215215
]
216216
);
217-
} elseif($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
217+
} elseif ($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
218218
$this->log(
219219
'The %s "%s" with ID "%s" has been unshared from the circle "%s" (Share ID: %s)',
220220
$params,
@@ -226,7 +226,7 @@ public function unshare(array $params) {
226226
'id',
227227
]
228228
);
229-
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
229+
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
230230
$this->log(
231231
'The %s "%s" with ID "%s" has been unshared from the remote user "%s" (Share ID: %s)',
232232
$params,
@@ -238,7 +238,7 @@ public function unshare(array $params) {
238238
'id',
239239
]
240240
);
241-
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
241+
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
242242
$this->log(
243243
'The %s "%s" with ID "%s" has been unshared from the remote group "%s" (Share ID: %s)',
244244
$params,

apps/admin_audit/lib/Actions/Trashbin.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
namespace OCA\AdminAudit\Actions;
3030

3131
class Trashbin extends Action {
32-
3332
public function delete(array $params) {
3433
$this->log('File "%s" deleted from trash bin.',
3534
['path' => $params['path']], ['path']
@@ -41,5 +40,4 @@ public function restore(array $params) {
4140
['path' => $params['filePath']], ['path']
4241
);
4342
}
44-
4543
}

apps/admin_audit/lib/Actions/UserManagement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function unassign(string $uid) {
100100
* @param array $params
101101
*/
102102
public function change(array $params) {
103-
switch($params['feature']) {
103+
switch ($params['feature']) {
104104
case 'enabled':
105105
$this->log(
106106
$params['value'] === true
@@ -130,7 +130,7 @@ public function change(array $params) {
130130
* @param IUser $user
131131
*/
132132
public function setPassword(IUser $user) {
133-
if($user->getBackendClassName() === 'Database') {
133+
if ($user->getBackendClassName() === 'Database') {
134134
$this->log(
135135
'Password of user "%s" has been changed',
136136
[

apps/admin_audit/lib/Actions/Versions.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
namespace OCA\AdminAudit\Actions;
3030

3131
class Versions extends Action {
32-
3332
public function rollback(array $params) {
3433
$this->log('Version "%s" of "%s" was restored.',
3534
[
@@ -46,5 +45,4 @@ public function delete(array $params) {
4645
['path']
4746
);
4847
}
49-
5048
}

apps/admin_audit/lib/AppInfo/Application.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ public function initLogger() {
7474

7575
$default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
7676
$logFile = $config->getAppValue('admin_audit', 'logfile', $default);
77-
if($logFile === null) {
77+
if ($logFile === null) {
7878
$this->logger = $c->getLogger();
7979
return;
8080
}
8181
$this->logger = $c->getLogFactory()->getCustomLogger($logFile);
82-
8382
}
8483

8584
public function register() {
@@ -152,7 +151,6 @@ protected function authHooks() {
152151
}
153152

154153
protected function appHooks() {
155-
156154
$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
157155
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) {
158156
$appActions = new AppManagement($this->logger);
@@ -166,7 +164,6 @@ protected function appHooks() {
166164
$appActions = new AppManagement($this->logger);
167165
$appActions->disableApp($event->getAppID());
168166
});
169-
170167
}
171168

172169
protected function consoleHooks() {

apps/admin_audit/lib/BackgroundJobs/Rotate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ protected function run($argument) {
3838
$default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
3939
$this->filePath = $config->getAppValue('admin_audit', 'logfile', $default);
4040

41-
if($this->filePath === '') {
41+
if ($this->filePath === '') {
4242
// default log file, nothing to do
4343
return;
4444
}
4545

4646
$this->maxSize = $config->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
4747

48-
if($this->shouldRotateBySize()) {
48+
if ($this->shouldRotateBySize()) {
4949
$this->rotate();
5050
}
5151
}

0 commit comments

Comments
 (0)