Completed
Push — master ( a67720...be1982 )
by Daniel
19:40 queued 14s
created
lib/public/DB/QueryBuilder/ICompositeExpression.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,39 +29,39 @@
 block discarded – undo
29 29
  * @since 8.2.0
30 30
  */
31 31
 interface ICompositeExpression {
32
-	/**
33
-	 * Adds multiple parts to composite expression.
34
-	 *
35
-	 * @param array $parts
36
-	 *
37
-	 * @return ICompositeExpression
38
-	 * @since 8.2.0
39
-	 */
40
-	public function addMultiple(array $parts = []): ICompositeExpression;
32
+    /**
33
+     * Adds multiple parts to composite expression.
34
+     *
35
+     * @param array $parts
36
+     *
37
+     * @return ICompositeExpression
38
+     * @since 8.2.0
39
+     */
40
+    public function addMultiple(array $parts = []): ICompositeExpression;
41 41
 
42
-	/**
43
-	 * Adds an expression to composite expression.
44
-	 *
45
-	 * @param mixed $part
46
-	 *
47
-	 * @return ICompositeExpression
48
-	 * @since 8.2.0
49
-	 */
50
-	public function add($part): ICompositeExpression;
42
+    /**
43
+     * Adds an expression to composite expression.
44
+     *
45
+     * @param mixed $part
46
+     *
47
+     * @return ICompositeExpression
48
+     * @since 8.2.0
49
+     */
50
+    public function add($part): ICompositeExpression;
51 51
 
52
-	/**
53
-	 * Retrieves the amount of expressions on composite expression.
54
-	 *
55
-	 * @return integer
56
-	 * @since 8.2.0
57
-	 */
58
-	public function count(): int;
52
+    /**
53
+     * Retrieves the amount of expressions on composite expression.
54
+     *
55
+     * @return integer
56
+     * @since 8.2.0
57
+     */
58
+    public function count(): int;
59 59
 
60
-	/**
61
-	 * Returns the type of this composite expression (AND/OR).
62
-	 *
63
-	 * @return string
64
-	 * @since 8.2.0
65
-	 */
66
-	public function getType(): string;
60
+    /**
61
+     * Returns the type of this composite expression (AND/OR).
62
+     *
63
+     * @return string
64
+     * @since 8.2.0
65
+     */
66
+    public function getType(): string;
67 67
 }
Please login to merge, or discard this patch.
core/Command/Group/Info.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 		$gid = $input->getArgument('groupid');
68 68
 		$group = $this->groupManager->get($gid);
69 69
 		if (!$group instanceof IGroup) {
70
-			$output->writeln('<error>Group "' . $gid . '" does not exist.</error>');
70
+			$output->writeln('<error>Group "'.$gid.'" does not exist.</error>');
71 71
 			return 1;
72 72
 		} else {
73 73
 			$groupOutput = [
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -35,56 +35,56 @@
 block discarded – undo
35 35
 use Symfony\Component\Console\Output\OutputInterface;
36 36
 
37 37
 class Info extends Base {
38
-	public function __construct(
39
-		protected IGroupManager $groupManager,
40
-	) {
41
-		parent::__construct();
42
-	}
38
+    public function __construct(
39
+        protected IGroupManager $groupManager,
40
+    ) {
41
+        parent::__construct();
42
+    }
43 43
 
44
-	protected function configure() {
45
-		$this
46
-			->setName('group:info')
47
-			->setDescription('Show information about a group')
48
-			->addArgument(
49
-				'groupid',
50
-				InputArgument::REQUIRED,
51
-				'Group id'
52
-			)->addOption(
53
-				'output',
54
-				null,
55
-				InputOption::VALUE_OPTIONAL,
56
-				'Output format (plain, json or json_pretty, default is plain)',
57
-				$this->defaultOutputFormat
58
-			);
59
-	}
44
+    protected function configure() {
45
+        $this
46
+            ->setName('group:info')
47
+            ->setDescription('Show information about a group')
48
+            ->addArgument(
49
+                'groupid',
50
+                InputArgument::REQUIRED,
51
+                'Group id'
52
+            )->addOption(
53
+                'output',
54
+                null,
55
+                InputOption::VALUE_OPTIONAL,
56
+                'Output format (plain, json or json_pretty, default is plain)',
57
+                $this->defaultOutputFormat
58
+            );
59
+    }
60 60
 
61
-	protected function execute(InputInterface $input, OutputInterface $output): int {
62
-		$gid = $input->getArgument('groupid');
63
-		$group = $this->groupManager->get($gid);
64
-		if (!$group instanceof IGroup) {
65
-			$output->writeln('<error>Group "' . $gid . '" does not exist.</error>');
66
-			return 1;
67
-		} else {
68
-			$groupOutput = [
69
-				'groupID' => $gid,
70
-				'displayName' => $group->getDisplayName(),
71
-				'backends' => $group->getBackendNames(),
72
-			];
61
+    protected function execute(InputInterface $input, OutputInterface $output): int {
62
+        $gid = $input->getArgument('groupid');
63
+        $group = $this->groupManager->get($gid);
64
+        if (!$group instanceof IGroup) {
65
+            $output->writeln('<error>Group "' . $gid . '" does not exist.</error>');
66
+            return 1;
67
+        } else {
68
+            $groupOutput = [
69
+                'groupID' => $gid,
70
+                'displayName' => $group->getDisplayName(),
71
+                'backends' => $group->getBackendNames(),
72
+            ];
73 73
 
74
-			$this->writeArrayInOutputFormat($input, $output, $groupOutput);
75
-			return 0;
76
-		}
77
-	}
74
+            $this->writeArrayInOutputFormat($input, $output, $groupOutput);
75
+            return 0;
76
+        }
77
+    }
78 78
 
79
-	/**
80
-	 * @param string $argumentName
81
-	 * @param CompletionContext $context
82
-	 * @return string[]
83
-	 */
84
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
85
-		if ($argumentName === 'groupid') {
86
-			return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord()));
87
-		}
88
-		return [];
89
-	}
79
+    /**
80
+     * @param string $argumentName
81
+     * @param CompletionContext $context
82
+     * @return string[]
83
+     */
84
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
85
+        if ($argumentName === 'groupid') {
86
+            return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord()));
87
+        }
88
+        return [];
89
+    }
90 90
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/Entry.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * sort the actions by priority and name
118 118
 	 */
119 119
 	private function sortActions(): void {
120
-		usort($this->actions, function (IAction $action1, IAction $action2) {
120
+		usort($this->actions, function(IAction $action1, IAction $action2) {
121 121
 			$prio1 = $action1->getPriority();
122 122
 			$prio2 = $action2->getPriority();
123 123
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function jsonSerialize(): array {
156 156
 		$topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
157
-		$otherActions = array_map(function (IAction $action) {
157
+		$otherActions = array_map(function(IAction $action) {
158 158
 			return $action->jsonSerialize();
159 159
 		}, array_slice($this->actions, 1));
160 160
 
Please login to merge, or discard this patch.
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -14,170 +14,170 @@
 block discarded – undo
14 14
 use function array_merge;
15 15
 
16 16
 class Entry implements IEntry {
17
-	public const PROPERTY_STATUS_MESSAGE_TIMESTAMP = 'statusMessageTimestamp';
18
-
19
-	/** @var string|int|null */
20
-	private $id = null;
21
-
22
-	private string $fullName = '';
23
-
24
-	/** @var string[] */
25
-	private array $emailAddresses = [];
26
-
27
-	private ?string $avatar = null;
28
-
29
-	private ?string $profileTitle = null;
30
-
31
-	private ?string $profileUrl = null;
32
-
33
-	/** @var IAction[] */
34
-	private array $actions = [];
35
-
36
-	private array $properties = [];
37
-
38
-	private ?string $status = null;
39
-	private ?string $statusMessage = null;
40
-	private ?int $statusMessageTimestamp = null;
41
-	private ?string $statusIcon = null;
42
-
43
-	public function setId(string $id): void {
44
-		$this->id = $id;
45
-	}
46
-
47
-	public function setFullName(string $displayName): void {
48
-		$this->fullName = $displayName;
49
-	}
50
-
51
-	public function getFullName(): string {
52
-		return $this->fullName;
53
-	}
54
-
55
-	public function addEMailAddress(string $address): void {
56
-		$this->emailAddresses[] = $address;
57
-	}
58
-
59
-	/**
60
-	 * @return string[]
61
-	 */
62
-	public function getEMailAddresses(): array {
63
-		return $this->emailAddresses;
64
-	}
65
-
66
-	public function setAvatar(string $avatar): void {
67
-		$this->avatar = $avatar;
68
-	}
69
-
70
-	public function getAvatar(): ?string {
71
-		return $this->avatar;
72
-	}
73
-
74
-	public function setProfileTitle(string $profileTitle): void {
75
-		$this->profileTitle = $profileTitle;
76
-	}
77
-
78
-	public function getProfileTitle(): ?string {
79
-		return $this->profileTitle;
80
-	}
81
-
82
-	public function setProfileUrl(string $profileUrl): void {
83
-		$this->profileUrl = $profileUrl;
84
-	}
85
-
86
-	public function getProfileUrl(): ?string {
87
-		return $this->profileUrl;
88
-	}
89
-
90
-	public function addAction(IAction $action): void {
91
-		$this->actions[] = $action;
92
-		$this->sortActions();
93
-	}
94
-
95
-	public function setStatus(string $status,
96
-		?string $statusMessage = null,
97
-		?int $statusMessageTimestamp = null,
98
-		?string $icon = null): void {
99
-		$this->status = $status;
100
-		$this->statusMessage = $statusMessage;
101
-		$this->statusMessageTimestamp = $statusMessageTimestamp;
102
-		$this->statusIcon = $icon;
103
-	}
104
-
105
-	/**
106
-	 * @return IAction[]
107
-	 */
108
-	public function getActions(): array {
109
-		return $this->actions;
110
-	}
111
-
112
-	/**
113
-	 * sort the actions by priority and name
114
-	 */
115
-	private function sortActions(): void {
116
-		usort($this->actions, function (IAction $action1, IAction $action2) {
117
-			$prio1 = $action1->getPriority();
118
-			$prio2 = $action2->getPriority();
119
-
120
-			if ($prio1 === $prio2) {
121
-				// Ascending order for same priority
122
-				return strcasecmp($action1->getName(), $action2->getName());
123
-			}
124
-
125
-			// Descending order when priority differs
126
-			return $prio2 - $prio1;
127
-		});
128
-	}
129
-
130
-	public function setProperty(string $propertyName, mixed $value) {
131
-		$this->properties[$propertyName] = $value;
132
-	}
133
-
134
-	/**
135
-	 * @param array $properties key-value array containing additional properties
136
-	 */
137
-	public function setProperties(array $properties): void {
138
-		$this->properties = array_merge($this->properties, $properties);
139
-	}
140
-
141
-	public function getProperty(string $key): mixed {
142
-		if (!isset($this->properties[$key])) {
143
-			return null;
144
-		}
145
-		return $this->properties[$key];
146
-	}
147
-
148
-	/**
149
-	 * @return array{id: int|string|null, fullName: string, avatar: string|null, topAction: mixed, actions: array, lastMessage: '', emailAddresses: string[], profileTitle: string|null, profileUrl: string|null, status: string|null, statusMessage: null|string, statusMessageTimestamp: null|int, statusIcon: null|string, isUser: bool, uid: mixed}
150
-	 */
151
-	public function jsonSerialize(): array {
152
-		$topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
153
-		$otherActions = array_map(function (IAction $action) {
154
-			return $action->jsonSerialize();
155
-		}, array_slice($this->actions, 1));
156
-
157
-		return [
158
-			'id' => $this->id,
159
-			'fullName' => $this->fullName,
160
-			'avatar' => $this->getAvatar(),
161
-			'topAction' => $topAction,
162
-			'actions' => $otherActions,
163
-			'lastMessage' => '',
164
-			'emailAddresses' => $this->getEMailAddresses(),
165
-			'profileTitle' => $this->profileTitle,
166
-			'profileUrl' => $this->profileUrl,
167
-			'status' => $this->status,
168
-			'statusMessage' => $this->statusMessage,
169
-			'statusMessageTimestamp' => $this->statusMessageTimestamp,
170
-			'statusIcon' => $this->statusIcon,
171
-			'isUser' => $this->getProperty('isUser') === true,
172
-			'uid' => $this->getProperty('UID'),
173
-		];
174
-	}
175
-
176
-	public function getStatusMessage(): ?string {
177
-		return $this->statusMessage;
178
-	}
179
-
180
-	public function getStatusMessageTimestamp(): ?int {
181
-		return $this->statusMessageTimestamp;
182
-	}
17
+    public const PROPERTY_STATUS_MESSAGE_TIMESTAMP = 'statusMessageTimestamp';
18
+
19
+    /** @var string|int|null */
20
+    private $id = null;
21
+
22
+    private string $fullName = '';
23
+
24
+    /** @var string[] */
25
+    private array $emailAddresses = [];
26
+
27
+    private ?string $avatar = null;
28
+
29
+    private ?string $profileTitle = null;
30
+
31
+    private ?string $profileUrl = null;
32
+
33
+    /** @var IAction[] */
34
+    private array $actions = [];
35
+
36
+    private array $properties = [];
37
+
38
+    private ?string $status = null;
39
+    private ?string $statusMessage = null;
40
+    private ?int $statusMessageTimestamp = null;
41
+    private ?string $statusIcon = null;
42
+
43
+    public function setId(string $id): void {
44
+        $this->id = $id;
45
+    }
46
+
47
+    public function setFullName(string $displayName): void {
48
+        $this->fullName = $displayName;
49
+    }
50
+
51
+    public function getFullName(): string {
52
+        return $this->fullName;
53
+    }
54
+
55
+    public function addEMailAddress(string $address): void {
56
+        $this->emailAddresses[] = $address;
57
+    }
58
+
59
+    /**
60
+     * @return string[]
61
+     */
62
+    public function getEMailAddresses(): array {
63
+        return $this->emailAddresses;
64
+    }
65
+
66
+    public function setAvatar(string $avatar): void {
67
+        $this->avatar = $avatar;
68
+    }
69
+
70
+    public function getAvatar(): ?string {
71
+        return $this->avatar;
72
+    }
73
+
74
+    public function setProfileTitle(string $profileTitle): void {
75
+        $this->profileTitle = $profileTitle;
76
+    }
77
+
78
+    public function getProfileTitle(): ?string {
79
+        return $this->profileTitle;
80
+    }
81
+
82
+    public function setProfileUrl(string $profileUrl): void {
83
+        $this->profileUrl = $profileUrl;
84
+    }
85
+
86
+    public function getProfileUrl(): ?string {
87
+        return $this->profileUrl;
88
+    }
89
+
90
+    public function addAction(IAction $action): void {
91
+        $this->actions[] = $action;
92
+        $this->sortActions();
93
+    }
94
+
95
+    public function setStatus(string $status,
96
+        ?string $statusMessage = null,
97
+        ?int $statusMessageTimestamp = null,
98
+        ?string $icon = null): void {
99
+        $this->status = $status;
100
+        $this->statusMessage = $statusMessage;
101
+        $this->statusMessageTimestamp = $statusMessageTimestamp;
102
+        $this->statusIcon = $icon;
103
+    }
104
+
105
+    /**
106
+     * @return IAction[]
107
+     */
108
+    public function getActions(): array {
109
+        return $this->actions;
110
+    }
111
+
112
+    /**
113
+     * sort the actions by priority and name
114
+     */
115
+    private function sortActions(): void {
116
+        usort($this->actions, function (IAction $action1, IAction $action2) {
117
+            $prio1 = $action1->getPriority();
118
+            $prio2 = $action2->getPriority();
119
+
120
+            if ($prio1 === $prio2) {
121
+                // Ascending order for same priority
122
+                return strcasecmp($action1->getName(), $action2->getName());
123
+            }
124
+
125
+            // Descending order when priority differs
126
+            return $prio2 - $prio1;
127
+        });
128
+    }
129
+
130
+    public function setProperty(string $propertyName, mixed $value) {
131
+        $this->properties[$propertyName] = $value;
132
+    }
133
+
134
+    /**
135
+     * @param array $properties key-value array containing additional properties
136
+     */
137
+    public function setProperties(array $properties): void {
138
+        $this->properties = array_merge($this->properties, $properties);
139
+    }
140
+
141
+    public function getProperty(string $key): mixed {
142
+        if (!isset($this->properties[$key])) {
143
+            return null;
144
+        }
145
+        return $this->properties[$key];
146
+    }
147
+
148
+    /**
149
+     * @return array{id: int|string|null, fullName: string, avatar: string|null, topAction: mixed, actions: array, lastMessage: '', emailAddresses: string[], profileTitle: string|null, profileUrl: string|null, status: string|null, statusMessage: null|string, statusMessageTimestamp: null|int, statusIcon: null|string, isUser: bool, uid: mixed}
150
+     */
151
+    public function jsonSerialize(): array {
152
+        $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
153
+        $otherActions = array_map(function (IAction $action) {
154
+            return $action->jsonSerialize();
155
+        }, array_slice($this->actions, 1));
156
+
157
+        return [
158
+            'id' => $this->id,
159
+            'fullName' => $this->fullName,
160
+            'avatar' => $this->getAvatar(),
161
+            'topAction' => $topAction,
162
+            'actions' => $otherActions,
163
+            'lastMessage' => '',
164
+            'emailAddresses' => $this->getEMailAddresses(),
165
+            'profileTitle' => $this->profileTitle,
166
+            'profileUrl' => $this->profileUrl,
167
+            'status' => $this->status,
168
+            'statusMessage' => $this->statusMessage,
169
+            'statusMessageTimestamp' => $this->statusMessageTimestamp,
170
+            'statusIcon' => $this->statusIcon,
171
+            'isUser' => $this->getProperty('isUser') === true,
172
+            'uid' => $this->getProperty('UID'),
173
+        ];
174
+    }
175
+
176
+    public function getStatusMessage(): ?string {
177
+        return $this->statusMessage;
178
+    }
179
+
180
+    public function getStatusMessageTimestamp(): ?int {
181
+        return $this->statusMessageTimestamp;
182
+    }
183 183
 }
Please login to merge, or discard this patch.
apps/admin_audit/lib/Actions/Trashbin.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
 namespace OCA\AdminAudit\Actions;
30 30
 
31 31
 class Trashbin extends Action {
32
-	public function delete(array $params): void {
33
-		$this->log('File "%s" deleted from trash bin.',
34
-			['path' => $params['path']], ['path']
35
-		);
36
-	}
32
+    public function delete(array $params): void {
33
+        $this->log('File "%s" deleted from trash bin.',
34
+            ['path' => $params['path']], ['path']
35
+        );
36
+    }
37 37
 
38
-	public function restore(array $params): void {
39
-		$this->log('File "%s" restored from trash bin.',
40
-			['path' => $params['filePath']], ['path']
41
-		);
42
-	}
38
+    public function restore(array $params): void {
39
+        $this->log('File "%s" restored from trash bin.',
40
+            ['path' => $params['filePath']], ['path']
41
+        );
42
+    }
43 43
 }
Please login to merge, or discard this patch.
lib/public/Share/Exceptions/AlreadySharedException.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,22 +29,22 @@
 block discarded – undo
29 29
  * @since 22.0.0
30 30
  */
31 31
 class AlreadySharedException extends GenericShareException {
32
-	/** @var IShare */
33
-	private $existingShare;
32
+    /** @var IShare */
33
+    private $existingShare;
34 34
 
35
-	/**
36
-	 * @since 22.0.0
37
-	 */
38
-	public function __construct(string $message, IShare $existingShare) {
39
-		parent::__construct($message);
35
+    /**
36
+     * @since 22.0.0
37
+     */
38
+    public function __construct(string $message, IShare $existingShare) {
39
+        parent::__construct($message);
40 40
 
41
-		$this->existingShare = $existingShare;
42
-	}
41
+        $this->existingShare = $existingShare;
42
+    }
43 43
 
44
-	/**
45
-	 * @since 22.0.0
46
-	 */
47
-	public function getExistingShare(): IShare {
48
-		return $this->existingShare;
49
-	}
44
+    /**
45
+     * @since 22.0.0
46
+     */
47
+    public function getExistingShare(): IShare {
48
+        return $this->existingShare;
49
+    }
50 50
 }
Please login to merge, or discard this patch.
apps/provisioning_api/lib/AppInfo/Application.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function register(IRegistrationContext $context): void {
61 61
 		$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
62 62
 
63
-		$context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) {
63
+		$context->registerService(NewUserMailHelper::class, function(ContainerInterface $c) {
64 64
 			return new NewUserMailHelper(
65 65
 				$c->get(Defaults::class),
66 66
 				$c->get(IURLGenerator::class),
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 				Util::getDefaultEmailAddress('no-reply')
74 74
 			);
75 75
 		});
76
-		$context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) {
76
+		$context->registerService(ProvisioningApiMiddleware::class, function(ContainerInterface $c) {
77 77
 			$user = $c->get(IUserManager::class)->get($c->get('UserId'));
78 78
 			$isAdmin = false;
79 79
 			$isSubAdmin = false;
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -54,48 +54,48 @@
 block discarded – undo
54 54
 use Psr\Container\ContainerInterface;
55 55
 
56 56
 class Application extends App implements IBootstrap {
57
-	public function __construct(array $urlParams = []) {
58
-		parent::__construct('provisioning_api', $urlParams);
59
-	}
57
+    public function __construct(array $urlParams = []) {
58
+        parent::__construct('provisioning_api', $urlParams);
59
+    }
60 60
 
61
-	public function register(IRegistrationContext $context): void {
62
-		$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
61
+    public function register(IRegistrationContext $context): void {
62
+        $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
63 63
 
64
-		$context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) {
65
-			return new NewUserMailHelper(
66
-				$c->get(Defaults::class),
67
-				$c->get(IURLGenerator::class),
68
-				$c->get(IFactory::class),
69
-				$c->get(IMailer::class),
70
-				$c->get(ISecureRandom::class),
71
-				$c->get(ITimeFactory::class),
72
-				$c->get(IConfig::class),
73
-				$c->get(ICrypto::class),
74
-				Util::getDefaultEmailAddress('no-reply')
75
-			);
76
-		});
77
-		$context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) {
78
-			$user = $c->get(IUserManager::class)->get($c->get('UserId'));
79
-			$isAdmin = false;
80
-			$isSubAdmin = false;
64
+        $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) {
65
+            return new NewUserMailHelper(
66
+                $c->get(Defaults::class),
67
+                $c->get(IURLGenerator::class),
68
+                $c->get(IFactory::class),
69
+                $c->get(IMailer::class),
70
+                $c->get(ISecureRandom::class),
71
+                $c->get(ITimeFactory::class),
72
+                $c->get(IConfig::class),
73
+                $c->get(ICrypto::class),
74
+                Util::getDefaultEmailAddress('no-reply')
75
+            );
76
+        });
77
+        $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) {
78
+            $user = $c->get(IUserManager::class)->get($c->get('UserId'));
79
+            $isAdmin = false;
80
+            $isSubAdmin = false;
81 81
 
82
-			if ($user instanceof IUser) {
83
-				$groupManager = $c->get(IGroupManager::class);
84
-				assert($groupManager instanceof GroupManager);
85
-				$isAdmin = $groupManager->isAdmin($user->getUID());
86
-				$isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user);
87
-			}
82
+            if ($user instanceof IUser) {
83
+                $groupManager = $c->get(IGroupManager::class);
84
+                assert($groupManager instanceof GroupManager);
85
+                $isAdmin = $groupManager->isAdmin($user->getUID());
86
+                $isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user);
87
+            }
88 88
 
89
-			return new ProvisioningApiMiddleware(
90
-				$c->get(IControllerMethodReflector::class),
91
-				$isAdmin,
92
-				$isSubAdmin
93
-			);
94
-		});
95
-		$context->registerMiddleware(ProvisioningApiMiddleware::class);
96
-		$context->registerCapability(Capabilities::class);
97
-	}
89
+            return new ProvisioningApiMiddleware(
90
+                $c->get(IControllerMethodReflector::class),
91
+                $isAdmin,
92
+                $isSubAdmin
93
+            );
94
+        });
95
+        $context->registerMiddleware(ProvisioningApiMiddleware::class);
96
+        $context->registerCapability(Capabilities::class);
97
+    }
98 98
 
99
-	public function boot(IBootContext $context): void {
100
-	}
99
+    public function boot(IBootContext $context): void {
100
+    }
101 101
 }
Please login to merge, or discard this patch.
lib/private/Files/Cache/MoveFromCacheTrait.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -30,31 +30,31 @@
 block discarded – undo
30 30
  * Fallback implementation for moveFromCache
31 31
  */
32 32
 trait MoveFromCacheTrait {
33
-	/**
34
-	 * store meta data for a file or folder
35
-	 *
36
-	 * @param string $file
37
-	 * @param array $data
38
-	 *
39
-	 * @return int file id
40
-	 * @throws \RuntimeException
41
-	 */
42
-	abstract public function put($file, array $data);
33
+    /**
34
+     * store meta data for a file or folder
35
+     *
36
+     * @param string $file
37
+     * @param array $data
38
+     *
39
+     * @return int file id
40
+     * @throws \RuntimeException
41
+     */
42
+    abstract public function put($file, array $data);
43 43
 
44
-	abstract public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int;
44
+    abstract public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int;
45 45
 
46
-	/**
47
-	 * Move a file or folder in the cache
48
-	 *
49
-	 * @param \OCP\Files\Cache\ICache $sourceCache
50
-	 * @param string $sourcePath
51
-	 * @param string $targetPath
52
-	 */
53
-	public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
54
-		$sourceEntry = $sourceCache->get($sourcePath);
46
+    /**
47
+     * Move a file or folder in the cache
48
+     *
49
+     * @param \OCP\Files\Cache\ICache $sourceCache
50
+     * @param string $sourcePath
51
+     * @param string $targetPath
52
+     */
53
+    public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
54
+        $sourceEntry = $sourceCache->get($sourcePath);
55 55
 
56
-		$this->copyFromCache($sourceCache, $sourceEntry, $targetPath);
56
+        $this->copyFromCache($sourceCache, $sourceEntry, $targetPath);
57 57
 
58
-		$sourceCache->remove($sourcePath);
59
-	}
58
+        $sourceCache->remove($sourcePath);
59
+    }
60 60
 }
Please login to merge, or discard this patch.
core/Migrations/Version21000Date20210309185127.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -31,22 +31,22 @@
 block discarded – undo
31 31
 use OCP\Migration\SimpleMigrationStep;
32 32
 
33 33
 class Version21000Date20210309185127 extends SimpleMigrationStep {
34
-	/**
35
-	 * @param IOutput $output
36
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
37
-	 * @param array $options
38
-	 * @return null|ISchemaWrapper
39
-	 */
40
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
41
-		/** @var ISchemaWrapper $schema */
42
-		$schema = $schemaClosure();
34
+    /**
35
+     * @param IOutput $output
36
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
37
+     * @param array $options
38
+     * @return null|ISchemaWrapper
39
+     */
40
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
41
+        /** @var ISchemaWrapper $schema */
42
+        $schema = $schemaClosure();
43 43
 
44
-		$table = $schema->getTable('known_users');
45
-		if (!$table->hasIndex('ku_known_user')) {
46
-			$table->addIndex(['known_user'], 'ku_known_user');
47
-			return $schema;
48
-		}
44
+        $table = $schema->getTable('known_users');
45
+        if (!$table->hasIndex('ku_known_user')) {
46
+            $table->addIndex(['known_user'], 'ku_known_user');
47
+            return $schema;
48
+        }
49 49
 
50
-		return null;
51
-	}
50
+        return null;
51
+    }
52 52
 }
Please login to merge, or discard this patch.
lib/private/Encryption/Update.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
91 91
 				$path = Filesystem::getPath($params['fileSource']);
92 92
 				[$owner, $ownerPath] = $this->getOwnerPath($path);
93
-				$absPath = '/' . $owner . '/files/' . $ownerPath;
93
+				$absPath = '/'.$owner.'/files/'.$ownerPath;
94 94
 				$this->update($absPath);
95 95
 			}
96 96
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
107 107
 				$path = Filesystem::getPath($params['fileSource']);
108 108
 				[$owner, $ownerPath] = $this->getOwnerPath($path);
109
-				$absPath = '/' . $owner . '/files/' . $ownerPath;
109
+				$absPath = '/'.$owner.'/files/'.$ownerPath;
110 110
 				$this->update($absPath);
111 111
 			}
112 112
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function postRestore($params) {
122 122
 		if ($this->encryptionManager->isEnabled()) {
123
-			$path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']);
123
+			$path = Filesystem::normalizePath('/'.$this->uid.'/files/'.$params['filePath']);
124 124
 			$this->update($path);
125 125
 		}
126 126
 	}
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			dirname($source) !== dirname($target)
140 140
 		) {
141 141
 			[$owner, $ownerPath] = $this->getOwnerPath($target);
142
-			$absPath = '/' . $owner . '/files/' . $ownerPath;
142
+			$absPath = '/'.$owner.'/files/'.$ownerPath;
143 143
 			$this->update($absPath);
144 144
 		}
145 145
 	}
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 	protected function getOwnerPath($path) {
155 155
 		$info = Filesystem::getFileInfo($path);
156 156
 		$owner = Filesystem::getOwner($path);
157
-		$view = new View('/' . $owner . '/files');
157
+		$view = new View('/'.$owner.'/files');
158 158
 		$path = $view->getPath($info->getId());
159 159
 		if ($path === null) {
160
-			throw new InvalidArgumentException('No file found for ' . $info->getId());
160
+			throw new InvalidArgumentException('No file found for '.$info->getId());
161 161
 		}
162 162
 
163 163
 		return [$owner, $path];
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 				$encryptionModule->update($file, $this->uid, $usersSharing);
194 194
 			} catch (GenericEncryptionException $e) {
195 195
 				// If the update of an individual file fails e.g. due to a corrupt key we should continue the operation and just log the failure
196
-				$this->logger->error('Failed to update encryption module for ' . $this->uid . ' ' . $file, [ 'exception' => $e ]);
196
+				$this->logger->error('Failed to update encryption module for '.$this->uid.' '.$file, ['exception' => $e]);
197 197
 			}
198 198
 		}
199 199
 	}
Please login to merge, or discard this patch.
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -18,163 +18,163 @@
 block discarded – undo
18 18
  * update encrypted files, e.g. because a file was shared
19 19
  */
20 20
 class Update {
21
-	/** @var View */
22
-	protected $view;
23
-
24
-	/** @var Util */
25
-	protected $util;
26
-
27
-	/** @var \OC\Files\Mount\Manager */
28
-	protected $mountManager;
29
-
30
-	/** @var Manager */
31
-	protected $encryptionManager;
32
-
33
-	/** @var string */
34
-	protected $uid;
35
-
36
-	/** @var File */
37
-	protected $file;
38
-
39
-	/** @var LoggerInterface */
40
-	protected $logger;
41
-
42
-	/**
43
-	 * @param string $uid
44
-	 */
45
-	public function __construct(
46
-		View $view,
47
-		Util $util,
48
-		Mount\Manager $mountManager,
49
-		Manager $encryptionManager,
50
-		File $file,
51
-		LoggerInterface $logger,
52
-		$uid,
53
-	) {
54
-		$this->view = $view;
55
-		$this->util = $util;
56
-		$this->mountManager = $mountManager;
57
-		$this->encryptionManager = $encryptionManager;
58
-		$this->file = $file;
59
-		$this->logger = $logger;
60
-		$this->uid = $uid;
61
-	}
62
-
63
-	/**
64
-	 * hook after file was shared
65
-	 *
66
-	 * @param array $params
67
-	 */
68
-	public function postShared($params) {
69
-		if ($this->encryptionManager->isEnabled()) {
70
-			if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
71
-				$path = Filesystem::getPath($params['fileSource']);
72
-				[$owner, $ownerPath] = $this->getOwnerPath($path);
73
-				$absPath = '/' . $owner . '/files/' . $ownerPath;
74
-				$this->update($absPath);
75
-			}
76
-		}
77
-	}
78
-
79
-	/**
80
-	 * hook after file was unshared
81
-	 *
82
-	 * @param array $params
83
-	 */
84
-	public function postUnshared($params) {
85
-		if ($this->encryptionManager->isEnabled()) {
86
-			if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
87
-				$path = Filesystem::getPath($params['fileSource']);
88
-				[$owner, $ownerPath] = $this->getOwnerPath($path);
89
-				$absPath = '/' . $owner . '/files/' . $ownerPath;
90
-				$this->update($absPath);
91
-			}
92
-		}
93
-	}
94
-
95
-	/**
96
-	 * inform encryption module that a file was restored from the trash bin,
97
-	 * e.g. to update the encryption keys
98
-	 *
99
-	 * @param array $params
100
-	 */
101
-	public function postRestore($params) {
102
-		if ($this->encryptionManager->isEnabled()) {
103
-			$path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']);
104
-			$this->update($path);
105
-		}
106
-	}
107
-
108
-	/**
109
-	 * inform encryption module that a file was renamed,
110
-	 * e.g. to update the encryption keys
111
-	 *
112
-	 * @param array $params
113
-	 */
114
-	public function postRename($params) {
115
-		$source = $params['oldpath'];
116
-		$target = $params['newpath'];
117
-		if (
118
-			$this->encryptionManager->isEnabled() &&
119
-			dirname($source) !== dirname($target)
120
-		) {
121
-			[$owner, $ownerPath] = $this->getOwnerPath($target);
122
-			$absPath = '/' . $owner . '/files/' . $ownerPath;
123
-			$this->update($absPath);
124
-		}
125
-	}
126
-
127
-	/**
128
-	 * get owner and path relative to data/<owner>/files
129
-	 *
130
-	 * @param string $path path to file for current user
131
-	 * @return array ['owner' => $owner, 'path' => $path]
132
-	 * @throws \InvalidArgumentException
133
-	 */
134
-	protected function getOwnerPath($path) {
135
-		$info = Filesystem::getFileInfo($path);
136
-		$owner = Filesystem::getOwner($path);
137
-		$view = new View('/' . $owner . '/files');
138
-		$path = $view->getPath($info->getId());
139
-		if ($path === null) {
140
-			throw new InvalidArgumentException('No file found for ' . $info->getId());
141
-		}
142
-
143
-		return [$owner, $path];
144
-	}
145
-
146
-	/**
147
-	 * notify encryption module about added/removed users from a file/folder
148
-	 *
149
-	 * @param string $path relative to data/
150
-	 * @throws Exceptions\ModuleDoesNotExistsException
151
-	 */
152
-	public function update($path) {
153
-		$encryptionModule = $this->encryptionManager->getEncryptionModule();
154
-
155
-		// if the encryption module doesn't encrypt the files on a per-user basis
156
-		// we have nothing to do here.
157
-		if ($encryptionModule->needDetailedAccessList() === false) {
158
-			return;
159
-		}
160
-
161
-		// if a folder was shared, get a list of all (sub-)folders
162
-		if ($this->view->is_dir($path)) {
163
-			$allFiles = $this->util->getAllFiles($path);
164
-		} else {
165
-			$allFiles = [$path];
166
-		}
167
-
168
-
169
-
170
-		foreach ($allFiles as $file) {
171
-			$usersSharing = $this->file->getAccessList($file);
172
-			try {
173
-				$encryptionModule->update($file, $this->uid, $usersSharing);
174
-			} catch (GenericEncryptionException $e) {
175
-				// If the update of an individual file fails e.g. due to a corrupt key we should continue the operation and just log the failure
176
-				$this->logger->error('Failed to update encryption module for ' . $this->uid . ' ' . $file, [ 'exception' => $e ]);
177
-			}
178
-		}
179
-	}
21
+    /** @var View */
22
+    protected $view;
23
+
24
+    /** @var Util */
25
+    protected $util;
26
+
27
+    /** @var \OC\Files\Mount\Manager */
28
+    protected $mountManager;
29
+
30
+    /** @var Manager */
31
+    protected $encryptionManager;
32
+
33
+    /** @var string */
34
+    protected $uid;
35
+
36
+    /** @var File */
37
+    protected $file;
38
+
39
+    /** @var LoggerInterface */
40
+    protected $logger;
41
+
42
+    /**
43
+     * @param string $uid
44
+     */
45
+    public function __construct(
46
+        View $view,
47
+        Util $util,
48
+        Mount\Manager $mountManager,
49
+        Manager $encryptionManager,
50
+        File $file,
51
+        LoggerInterface $logger,
52
+        $uid,
53
+    ) {
54
+        $this->view = $view;
55
+        $this->util = $util;
56
+        $this->mountManager = $mountManager;
57
+        $this->encryptionManager = $encryptionManager;
58
+        $this->file = $file;
59
+        $this->logger = $logger;
60
+        $this->uid = $uid;
61
+    }
62
+
63
+    /**
64
+     * hook after file was shared
65
+     *
66
+     * @param array $params
67
+     */
68
+    public function postShared($params) {
69
+        if ($this->encryptionManager->isEnabled()) {
70
+            if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
71
+                $path = Filesystem::getPath($params['fileSource']);
72
+                [$owner, $ownerPath] = $this->getOwnerPath($path);
73
+                $absPath = '/' . $owner . '/files/' . $ownerPath;
74
+                $this->update($absPath);
75
+            }
76
+        }
77
+    }
78
+
79
+    /**
80
+     * hook after file was unshared
81
+     *
82
+     * @param array $params
83
+     */
84
+    public function postUnshared($params) {
85
+        if ($this->encryptionManager->isEnabled()) {
86
+            if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
87
+                $path = Filesystem::getPath($params['fileSource']);
88
+                [$owner, $ownerPath] = $this->getOwnerPath($path);
89
+                $absPath = '/' . $owner . '/files/' . $ownerPath;
90
+                $this->update($absPath);
91
+            }
92
+        }
93
+    }
94
+
95
+    /**
96
+     * inform encryption module that a file was restored from the trash bin,
97
+     * e.g. to update the encryption keys
98
+     *
99
+     * @param array $params
100
+     */
101
+    public function postRestore($params) {
102
+        if ($this->encryptionManager->isEnabled()) {
103
+            $path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']);
104
+            $this->update($path);
105
+        }
106
+    }
107
+
108
+    /**
109
+     * inform encryption module that a file was renamed,
110
+     * e.g. to update the encryption keys
111
+     *
112
+     * @param array $params
113
+     */
114
+    public function postRename($params) {
115
+        $source = $params['oldpath'];
116
+        $target = $params['newpath'];
117
+        if (
118
+            $this->encryptionManager->isEnabled() &&
119
+            dirname($source) !== dirname($target)
120
+        ) {
121
+            [$owner, $ownerPath] = $this->getOwnerPath($target);
122
+            $absPath = '/' . $owner . '/files/' . $ownerPath;
123
+            $this->update($absPath);
124
+        }
125
+    }
126
+
127
+    /**
128
+     * get owner and path relative to data/<owner>/files
129
+     *
130
+     * @param string $path path to file for current user
131
+     * @return array ['owner' => $owner, 'path' => $path]
132
+     * @throws \InvalidArgumentException
133
+     */
134
+    protected function getOwnerPath($path) {
135
+        $info = Filesystem::getFileInfo($path);
136
+        $owner = Filesystem::getOwner($path);
137
+        $view = new View('/' . $owner . '/files');
138
+        $path = $view->getPath($info->getId());
139
+        if ($path === null) {
140
+            throw new InvalidArgumentException('No file found for ' . $info->getId());
141
+        }
142
+
143
+        return [$owner, $path];
144
+    }
145
+
146
+    /**
147
+     * notify encryption module about added/removed users from a file/folder
148
+     *
149
+     * @param string $path relative to data/
150
+     * @throws Exceptions\ModuleDoesNotExistsException
151
+     */
152
+    public function update($path) {
153
+        $encryptionModule = $this->encryptionManager->getEncryptionModule();
154
+
155
+        // if the encryption module doesn't encrypt the files on a per-user basis
156
+        // we have nothing to do here.
157
+        if ($encryptionModule->needDetailedAccessList() === false) {
158
+            return;
159
+        }
160
+
161
+        // if a folder was shared, get a list of all (sub-)folders
162
+        if ($this->view->is_dir($path)) {
163
+            $allFiles = $this->util->getAllFiles($path);
164
+        } else {
165
+            $allFiles = [$path];
166
+        }
167
+
168
+
169
+
170
+        foreach ($allFiles as $file) {
171
+            $usersSharing = $this->file->getAccessList($file);
172
+            try {
173
+                $encryptionModule->update($file, $this->uid, $usersSharing);
174
+            } catch (GenericEncryptionException $e) {
175
+                // If the update of an individual file fails e.g. due to a corrupt key we should continue the operation and just log the failure
176
+                $this->logger->error('Failed to update encryption module for ' . $this->uid . ' ' . $file, [ 'exception' => $e ]);
177
+            }
178
+        }
179
+    }
180 180
 }
Please login to merge, or discard this patch.