Passed
Push — master ( 5ad730...5c1154 )
by John
13:07 queued 13s
created
lib/public/Broadcast/Events/IBroadcastEvent.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,27 +31,27 @@
 block discarded – undo
31 31
  */
32 32
 interface IBroadcastEvent {
33 33
 
34
-	/**
35
-	 * @return string the name of the event
36
-	 * @since 18.0.0
37
-	 */
38
-	public function getName(): string;
39
-
40
-	/**
41
-	 * @return string[]
42
-	 * @since 18.0.0
43
-	 */
44
-	public function getUids(): array;
45
-
46
-	/**
47
-	 * @return JsonSerializable the data to be sent to the client
48
-	 * @since 18.0.0
49
-	 */
50
-	public function getPayload(): JsonSerializable;
51
-
52
-	/**
53
-	 * @since 18.0.0
54
-	 */
55
-	public function setBroadcasted(): void;
34
+    /**
35
+     * @return string the name of the event
36
+     * @since 18.0.0
37
+     */
38
+    public function getName(): string;
39
+
40
+    /**
41
+     * @return string[]
42
+     * @since 18.0.0
43
+     */
44
+    public function getUids(): array;
45
+
46
+    /**
47
+     * @return JsonSerializable the data to be sent to the client
48
+     * @since 18.0.0
49
+     */
50
+    public function getPayload(): JsonSerializable;
51
+
52
+    /**
53
+     * @since 18.0.0
54
+     */
55
+    public function setBroadcasted(): void;
56 56
 
57 57
 }
Please login to merge, or discard this patch.
lib/public/EventDispatcher/ABroadcastedEvent.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -31,41 +31,41 @@
 block discarded – undo
31 31
  */
32 32
 abstract class ABroadcastedEvent extends Event implements JsonSerializable {
33 33
 
34
-	/**
35
-	 * @since 18.0.0
36
-	 */
37
-	private $broadcasted = false;
34
+    /**
35
+     * @since 18.0.0
36
+     */
37
+    private $broadcasted = false;
38 38
 
39
-	/**
40
-	 * Get the name of the event, as received on the client-side
41
-	 *
42
-	 * Uses the fully qualified event class name by default
43
-	 *
44
-	 * @return string
45
-	 * @since 18.0.0
46
-	 */
47
-	public function broadcastAs(): string {
48
-		return get_class($this);
49
-	}
39
+    /**
40
+     * Get the name of the event, as received on the client-side
41
+     *
42
+     * Uses the fully qualified event class name by default
43
+     *
44
+     * @return string
45
+     * @since 18.0.0
46
+     */
47
+    public function broadcastAs(): string {
48
+        return get_class($this);
49
+    }
50 50
 
51
-	/**
52
-	 * @return string[]
53
-	 * @since 18.0.0
54
-	 */
55
-	abstract public function getUids(): array;
51
+    /**
52
+     * @return string[]
53
+     * @since 18.0.0
54
+     */
55
+    abstract public function getUids(): array;
56 56
 
57
-	/**
58
-	 * @since 18.0.0
59
-	 */
60
-	public function setBroadcasted(): void {
61
-		$this->broadcasted = true;
62
-	}
57
+    /**
58
+     * @since 18.0.0
59
+     */
60
+    public function setBroadcasted(): void {
61
+        $this->broadcasted = true;
62
+    }
63 63
 
64
-	/**
65
-	 * @since 18.0.0
66
-	 */
67
-	public function isBroadcasted(): bool {
68
-		return $this->broadcasted;
69
-	}
64
+    /**
65
+     * @since 18.0.0
66
+     */
67
+    public function isBroadcasted(): bool {
68
+        return $this->broadcasted;
69
+    }
70 70
 
71 71
 }
Please login to merge, or discard this patch.
lib/private/Broadcast/Events/BroadcastEvent.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -31,29 +31,29 @@
 block discarded – undo
31 31
 
32 32
 class BroadcastEvent extends Event implements IBroadcastEvent {
33 33
 
34
-	/** @var ABroadcastedEvent */
35
-	private $event;
34
+    /** @var ABroadcastedEvent */
35
+    private $event;
36 36
 
37
-	public function __construct(ABroadcastedEvent $event) {
38
-		parent::__construct();
37
+    public function __construct(ABroadcastedEvent $event) {
38
+        parent::__construct();
39 39
 
40
-		$this->event = $event;
41
-	}
40
+        $this->event = $event;
41
+    }
42 42
 
43
-	public function getName(): string {
44
-		return $this->event->broadcastAs();
45
-	}
43
+    public function getName(): string {
44
+        return $this->event->broadcastAs();
45
+    }
46 46
 
47
-	public function getUids(): array {
48
-		return $this->event->getUids();
49
-	}
47
+    public function getUids(): array {
48
+        return $this->event->getUids();
49
+    }
50 50
 
51
-	public function getPayload(): JsonSerializable {
52
-		return $this->event;
53
-	}
51
+    public function getPayload(): JsonSerializable {
52
+        return $this->event;
53
+    }
54 54
 
55
-	public function setBroadcasted(): void {
56
-		$this->event->setBroadcasted();
57
-	}
55
+    public function setBroadcasted(): void {
56
+        $this->event->setBroadcasted();
57
+    }
58 58
 
59 59
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Command/ExiprationNotification.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 		//Current time
66 66
 		$minTime = $this->time->getDateTime();
67 67
 		$minTime->add(new \DateInterval('P1D'));
68
-		$minTime->setTime(0,0,0);
68
+		$minTime->setTime(0, 0, 0);
69 69
 
70 70
 		$maxTime = clone $minTime;
71 71
 		$maxTime->setTime(23, 59, 59);
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -36,64 +36,64 @@
 block discarded – undo
36 36
 use Symfony\Component\Console\Output\OutputInterface;
37 37
 
38 38
 class ExiprationNotification extends Command {
39
-	/** @var NotificationManager */
40
-	private $notificationManager;
41
-	/** @var IDBConnection */
42
-	private $connection;
43
-	/** @var ITimeFactory */
44
-	private $time;
45
-	/** @var ShareManager */
46
-	private $shareManager;
39
+    /** @var NotificationManager */
40
+    private $notificationManager;
41
+    /** @var IDBConnection */
42
+    private $connection;
43
+    /** @var ITimeFactory */
44
+    private $time;
45
+    /** @var ShareManager */
46
+    private $shareManager;
47 47
 
48
-	public function __construct(ITimeFactory $time,
49
-								NotificationManager $notificationManager,
50
-								IDBConnection $connection,
51
-								ShareManager $shareManager) {
52
-		parent::__construct();
48
+    public function __construct(ITimeFactory $time,
49
+                                NotificationManager $notificationManager,
50
+                                IDBConnection $connection,
51
+                                ShareManager $shareManager) {
52
+        parent::__construct();
53 53
 
54
-		$this->notificationManager = $notificationManager;
55
-		$this->connection = $connection;
56
-		$this->time = $time;
57
-		$this->shareManager = $shareManager;
58
-	}
54
+        $this->notificationManager = $notificationManager;
55
+        $this->connection = $connection;
56
+        $this->time = $time;
57
+        $this->shareManager = $shareManager;
58
+    }
59 59
 
60
-	protected function configure() {
61
-		$this
62
-			->setName('sharing:expiration-notification')
63
-			->setDescription('Notify share initiators when a share will expire the next day.');
64
-	}
60
+    protected function configure() {
61
+        $this
62
+            ->setName('sharing:expiration-notification')
63
+            ->setDescription('Notify share initiators when a share will expire the next day.');
64
+    }
65 65
 
66
-	public function execute(InputInterface $input, OutputInterface $output): int {
67
-		//Current time
68
-		$minTime = $this->time->getDateTime();
69
-		$minTime->add(new \DateInterval('P1D'));
70
-		$minTime->setTime(0,0,0);
66
+    public function execute(InputInterface $input, OutputInterface $output): int {
67
+        //Current time
68
+        $minTime = $this->time->getDateTime();
69
+        $minTime->add(new \DateInterval('P1D'));
70
+        $minTime->setTime(0,0,0);
71 71
 
72
-		$maxTime = clone $minTime;
73
-		$maxTime->setTime(23, 59, 59);
72
+        $maxTime = clone $minTime;
73
+        $maxTime->setTime(23, 59, 59);
74 74
 
75
-		$shares = $this->shareManager->getAllShares();
75
+        $shares = $this->shareManager->getAllShares();
76 76
 
77
-		$now = $this->time->getDateTime();
77
+        $now = $this->time->getDateTime();
78 78
 
79
-		/** @var IShare $share */
80
-		foreach ($shares as $share) {
81
-			if ($share->getExpirationDate() === null
82
-				|| $share->getExpirationDate()->getTimestamp() < $minTime->getTimestamp()
83
-				|| $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()) {
84
-				continue;
85
-			}
79
+        /** @var IShare $share */
80
+        foreach ($shares as $share) {
81
+            if ($share->getExpirationDate() === null
82
+                || $share->getExpirationDate()->getTimestamp() < $minTime->getTimestamp()
83
+                || $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()) {
84
+                continue;
85
+            }
86 86
 
87
-			$notification = $this->notificationManager->createNotification();
88
-			$notification->setApp('files_sharing')
89
-				->setDateTime($now)
90
-				->setObject('share', $share->getFullId())
91
-				->setSubject('expiresTomorrow');
87
+            $notification = $this->notificationManager->createNotification();
88
+            $notification->setApp('files_sharing')
89
+                ->setDateTime($now)
90
+                ->setObject('share', $share->getFullId())
91
+                ->setSubject('expiresTomorrow');
92 92
 
93
-			// Only send to initiator for now
94
-			$notification->setUser($share->getSharedBy());
95
-			$this->notificationManager->notify($notification);
96
-		}
97
-		return 0;
98
-	}
93
+            // Only send to initiator for now
94
+            $notification->setUser($share->getSharedBy());
95
+            $this->notificationManager->notify($notification);
96
+        }
97
+        return 0;
98
+    }
99 99
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/IOperationCompat.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@
 block discarded – undo
36 36
  * @deprecated
37 37
  */
38 38
 interface IOperationCompat {
39
-	/**
40
-	 * Like onEvent, but used with events that are not based on
41
-	 * \OCP\EventDispatcher\Event.
42
-	 *
43
-	 * This method is introduced for compatibility reasons and will be removed
44
-	 * in 2023 again.
45
-	 *
46
-	 * @since 18.0.0
47
-	 * @deprecated
48
-	 */
49
-	public function onEventCompat(string $eventName, $event, IRuleMatcher $ruleMatcher): void;
39
+    /**
40
+     * Like onEvent, but used with events that are not based on
41
+     * \OCP\EventDispatcher\Event.
42
+     *
43
+     * This method is introduced for compatibility reasons and will be removed
44
+     * in 2023 again.
45
+     *
46
+     * @since 18.0.0
47
+     * @deprecated
48
+     */
49
+    public function onEventCompat(string $eventName, $event, IRuleMatcher $ruleMatcher): void;
50 50
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/IEntityCompat.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@
 block discarded – undo
36 36
  * @deprecated
37 37
  */
38 38
 interface IEntityCompat extends IEntity {
39
-	/**
40
-	 * Like prepareRuleMatcherCompat, but works with events that are not based
41
-	 * on \OCP\EventDispatcher\Event.
42
-	 *
43
-	 * @since 18.0.0
44
-	 * @deprecated
45
-	 */
46
-	public function prepareRuleMatcherCompat(IRuleMatcher $ruleMatcher, string $eventName, $event): void;
39
+    /**
40
+     * Like prepareRuleMatcherCompat, but works with events that are not based
41
+     * on \OCP\EventDispatcher\Event.
42
+     *
43
+     * @since 18.0.0
44
+     * @deprecated
45
+     */
46
+    public function prepareRuleMatcherCompat(IRuleMatcher $ruleMatcher, string $eventName, $event): void;
47 47
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Trash/TrashItem.php 1 patch
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -25,164 +25,164 @@
 block discarded – undo
25 25
 use OCP\IUser;
26 26
 
27 27
 class TrashItem implements ITrashItem {
28
-	/** @var ITrashBackend */
29
-	private $backend;
30
-	/** @var string */
31
-	private $orignalLocation;
32
-	/** @var int */
33
-	private $deletedTime;
34
-	/** @var string */
35
-	private $trashPath;
36
-	/** @var FileInfo */
37
-	private $fileInfo;
38
-	/** @var IUser */
39
-	private $user;
40
-
41
-	public function __construct(
42
-		ITrashBackend $backend,
43
-		string $originalLocation,
44
-		int $deletedTime,
45
-		string $trashPath,
46
-		FileInfo $fileInfo,
47
-		IUser $user
48
-	) {
49
-		$this->backend = $backend;
50
-		$this->orignalLocation = $originalLocation;
51
-		$this->deletedTime = $deletedTime;
52
-		$this->trashPath = $trashPath;
53
-		$this->fileInfo = $fileInfo;
54
-		$this->user = $user;
55
-	}
56
-
57
-	public function getTrashBackend(): ITrashBackend {
58
-		return $this->backend;
59
-	}
60
-
61
-	public function getOriginalLocation(): string {
62
-		return $this->orignalLocation;
63
-	}
64
-
65
-	public function getDeletedTime(): int {
66
-		return $this->deletedTime;
67
-	}
68
-
69
-	public function getTrashPath(): string {
70
-		return $this->trashPath;
71
-	}
72
-
73
-	public function isRootItem(): bool {
74
-		return substr_count($this->getTrashPath(), '/') === 1;
75
-	}
76
-
77
-	public function getUser(): IUser {
78
-		return $this->user;
79
-	}
80
-
81
-	public function getEtag() {
82
-		return $this->fileInfo->getEtag();
83
-	}
84
-
85
-	public function getSize($includeMounts = true) {
86
-		return $this->fileInfo->getSize($includeMounts);
87
-	}
88
-
89
-	public function getMtime() {
90
-		return $this->fileInfo->getMtime();
91
-	}
92
-
93
-	public function getName() {
94
-		return $this->fileInfo->getName();
95
-	}
96
-
97
-	public function getInternalPath() {
98
-		return $this->fileInfo->getInternalPath();
99
-	}
100
-
101
-	public function getPath() {
102
-		return $this->fileInfo->getPath();
103
-	}
104
-
105
-	public function getMimetype() {
106
-		return $this->fileInfo->getMimetype();
107
-	}
108
-
109
-	public function getMimePart() {
110
-		return $this->fileInfo->getMimePart();
111
-	}
112
-
113
-	public function getStorage() {
114
-		return $this->fileInfo->getStorage();
115
-	}
116
-
117
-	public function getId() {
118
-		return $this->fileInfo->getId();
119
-	}
120
-
121
-	public function isEncrypted() {
122
-		return $this->fileInfo->isEncrypted();
123
-	}
124
-
125
-	public function getPermissions() {
126
-		return $this->fileInfo->getPermissions();
127
-	}
128
-
129
-	public function getType() {
130
-		return $this->fileInfo->getType();
131
-	}
132
-
133
-	public function isReadable() {
134
-		return $this->fileInfo->isReadable();
135
-	}
136
-
137
-	public function isUpdateable() {
138
-		return $this->fileInfo->isUpdateable();
139
-	}
140
-
141
-	public function isCreatable() {
142
-		return $this->fileInfo->isCreatable();
143
-	}
144
-
145
-	public function isDeletable() {
146
-		return $this->fileInfo->isDeletable();
147
-	}
148
-
149
-	public function isShareable() {
150
-		return $this->fileInfo->isShareable();
151
-	}
152
-
153
-	public function isShared() {
154
-		return $this->fileInfo->isShared();
155
-	}
28
+    /** @var ITrashBackend */
29
+    private $backend;
30
+    /** @var string */
31
+    private $orignalLocation;
32
+    /** @var int */
33
+    private $deletedTime;
34
+    /** @var string */
35
+    private $trashPath;
36
+    /** @var FileInfo */
37
+    private $fileInfo;
38
+    /** @var IUser */
39
+    private $user;
40
+
41
+    public function __construct(
42
+        ITrashBackend $backend,
43
+        string $originalLocation,
44
+        int $deletedTime,
45
+        string $trashPath,
46
+        FileInfo $fileInfo,
47
+        IUser $user
48
+    ) {
49
+        $this->backend = $backend;
50
+        $this->orignalLocation = $originalLocation;
51
+        $this->deletedTime = $deletedTime;
52
+        $this->trashPath = $trashPath;
53
+        $this->fileInfo = $fileInfo;
54
+        $this->user = $user;
55
+    }
56
+
57
+    public function getTrashBackend(): ITrashBackend {
58
+        return $this->backend;
59
+    }
60
+
61
+    public function getOriginalLocation(): string {
62
+        return $this->orignalLocation;
63
+    }
64
+
65
+    public function getDeletedTime(): int {
66
+        return $this->deletedTime;
67
+    }
68
+
69
+    public function getTrashPath(): string {
70
+        return $this->trashPath;
71
+    }
72
+
73
+    public function isRootItem(): bool {
74
+        return substr_count($this->getTrashPath(), '/') === 1;
75
+    }
76
+
77
+    public function getUser(): IUser {
78
+        return $this->user;
79
+    }
80
+
81
+    public function getEtag() {
82
+        return $this->fileInfo->getEtag();
83
+    }
84
+
85
+    public function getSize($includeMounts = true) {
86
+        return $this->fileInfo->getSize($includeMounts);
87
+    }
88
+
89
+    public function getMtime() {
90
+        return $this->fileInfo->getMtime();
91
+    }
92
+
93
+    public function getName() {
94
+        return $this->fileInfo->getName();
95
+    }
96
+
97
+    public function getInternalPath() {
98
+        return $this->fileInfo->getInternalPath();
99
+    }
100
+
101
+    public function getPath() {
102
+        return $this->fileInfo->getPath();
103
+    }
104
+
105
+    public function getMimetype() {
106
+        return $this->fileInfo->getMimetype();
107
+    }
108
+
109
+    public function getMimePart() {
110
+        return $this->fileInfo->getMimePart();
111
+    }
112
+
113
+    public function getStorage() {
114
+        return $this->fileInfo->getStorage();
115
+    }
116
+
117
+    public function getId() {
118
+        return $this->fileInfo->getId();
119
+    }
120
+
121
+    public function isEncrypted() {
122
+        return $this->fileInfo->isEncrypted();
123
+    }
124
+
125
+    public function getPermissions() {
126
+        return $this->fileInfo->getPermissions();
127
+    }
128
+
129
+    public function getType() {
130
+        return $this->fileInfo->getType();
131
+    }
132
+
133
+    public function isReadable() {
134
+        return $this->fileInfo->isReadable();
135
+    }
136
+
137
+    public function isUpdateable() {
138
+        return $this->fileInfo->isUpdateable();
139
+    }
140
+
141
+    public function isCreatable() {
142
+        return $this->fileInfo->isCreatable();
143
+    }
144
+
145
+    public function isDeletable() {
146
+        return $this->fileInfo->isDeletable();
147
+    }
148
+
149
+    public function isShareable() {
150
+        return $this->fileInfo->isShareable();
151
+    }
152
+
153
+    public function isShared() {
154
+        return $this->fileInfo->isShared();
155
+    }
156 156
 
157
-	public function isMounted() {
158
-		return $this->fileInfo->isMounted();
159
-	}
157
+    public function isMounted() {
158
+        return $this->fileInfo->isMounted();
159
+    }
160 160
 
161
-	public function getMountPoint() {
162
-		return $this->fileInfo->getMountPoint();
163
-	}
161
+    public function getMountPoint() {
162
+        return $this->fileInfo->getMountPoint();
163
+    }
164 164
 
165
-	public function getOwner() {
166
-		return $this->fileInfo->getOwner();
167
-	}
165
+    public function getOwner() {
166
+        return $this->fileInfo->getOwner();
167
+    }
168 168
 
169
-	public function getChecksum() {
170
-		return $this->fileInfo->getChecksum();
171
-	}
169
+    public function getChecksum() {
170
+        return $this->fileInfo->getChecksum();
171
+    }
172 172
 
173
-	public function getExtension(): string {
174
-		return $this->fileInfo->getExtension();
175
-	}
173
+    public function getExtension(): string {
174
+        return $this->fileInfo->getExtension();
175
+    }
176 176
 
177
-	public function getTitle(): string {
178
-		return $this->getOriginalLocation();
179
-	}
177
+    public function getTitle(): string {
178
+        return $this->getOriginalLocation();
179
+    }
180 180
 
181
-	public function getCreationTime(): int {
182
-		return $this->fileInfo->getCreationTime();
183
-	}
181
+    public function getCreationTime(): int {
182
+        return $this->fileInfo->getCreationTime();
183
+    }
184 184
 
185
-	public function getUploadTime(): int {
186
-		return $this->fileInfo->getUploadTime();
187
-	}
185
+    public function getUploadTime(): int {
186
+        return $this->fileInfo->getUploadTime();
187
+    }
188 188
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Notification/Notifier.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 
233 233
 		$placeholders = $replacements = [];
234 234
 		foreach ($subjectParameters as $placeholder => $parameter) {
235
-			$placeholders[] = '{' . $placeholder . '}';
235
+			$placeholders[] = '{'.$placeholder.'}';
236 236
 			$replacements[] = $parameter['name'];
237 237
 		}
238 238
 
Please login to merge, or discard this patch.
Indentation   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -43,215 +43,215 @@
 block discarded – undo
43 43
 use OCP\Share\IShare;
44 44
 
45 45
 class Notifier implements INotifier {
46
-	public const INCOMING_USER_SHARE = 'incoming_user_share';
47
-	public const INCOMING_GROUP_SHARE = 'incoming_group_share';
46
+    public const INCOMING_USER_SHARE = 'incoming_user_share';
47
+    public const INCOMING_GROUP_SHARE = 'incoming_group_share';
48 48
 
49
-	/** @var IFactory */
50
-	protected $l10nFactory;
51
-	/** @var IManager */
52
-	private $shareManager;
53
-	/** @var IRootFolder */
54
-	private $rootFolder;
55
-	/** @var IGroupManager  */
56
-	protected $groupManager;
57
-	/** @var IUserManager  */
58
-	protected $userManager;
59
-	/** @var IURLGenerator */
60
-	protected $url;
49
+    /** @var IFactory */
50
+    protected $l10nFactory;
51
+    /** @var IManager */
52
+    private $shareManager;
53
+    /** @var IRootFolder */
54
+    private $rootFolder;
55
+    /** @var IGroupManager  */
56
+    protected $groupManager;
57
+    /** @var IUserManager  */
58
+    protected $userManager;
59
+    /** @var IURLGenerator */
60
+    protected $url;
61 61
 
62
-	public function __construct(IFactory $l10nFactory,
63
-								IManager $shareManager,
64
-								IRootFolder $rootFolder,
65
-								IGroupManager $groupManager,
66
-								IUserManager $userManager,
67
-								IURLGenerator $url) {
68
-		$this->l10nFactory = $l10nFactory;
69
-		$this->shareManager = $shareManager;
70
-		$this->rootFolder = $rootFolder;
71
-		$this->groupManager = $groupManager;
72
-		$this->userManager = $userManager;
73
-		$this->url = $url;
74
-	}
62
+    public function __construct(IFactory $l10nFactory,
63
+                                IManager $shareManager,
64
+                                IRootFolder $rootFolder,
65
+                                IGroupManager $groupManager,
66
+                                IUserManager $userManager,
67
+                                IURLGenerator $url) {
68
+        $this->l10nFactory = $l10nFactory;
69
+        $this->shareManager = $shareManager;
70
+        $this->rootFolder = $rootFolder;
71
+        $this->groupManager = $groupManager;
72
+        $this->userManager = $userManager;
73
+        $this->url = $url;
74
+    }
75 75
 
76
-	/**
77
-	 * Identifier of the notifier, only use [a-z0-9_]
78
-	 *
79
-	 * @return string
80
-	 * @since 17.0.0
81
-	 */
82
-	public function getID(): string {
83
-		return 'files_sharing';
84
-	}
76
+    /**
77
+     * Identifier of the notifier, only use [a-z0-9_]
78
+     *
79
+     * @return string
80
+     * @since 17.0.0
81
+     */
82
+    public function getID(): string {
83
+        return 'files_sharing';
84
+    }
85 85
 
86
-	/**
87
-	 * Human readable name describing the notifier
88
-	 *
89
-	 * @return string
90
-	 * @since 17.0.0
91
-	 */
92
-	public function getName(): string {
93
-		return $this->l10nFactory->get('files_sharing')->t('File sharing');
94
-	}
86
+    /**
87
+     * Human readable name describing the notifier
88
+     *
89
+     * @return string
90
+     * @since 17.0.0
91
+     */
92
+    public function getName(): string {
93
+        return $this->l10nFactory->get('files_sharing')->t('File sharing');
94
+    }
95 95
 
96
-	/**
97
-	 * @param INotification $notification
98
-	 * @param string $languageCode The code of the language that should be used to prepare the notification
99
-	 * @return INotification
100
-	 * @throws \InvalidArgumentException When the notification was not prepared by a notifier
101
-	 * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted
102
-	 * @since 9.0.0
103
-	 */
104
-	public function prepare(INotification $notification, string $languageCode): INotification {
105
-		if ($notification->getApp() !== 'files_sharing' ||
106
-			($notification->getSubject() !== 'expiresTomorrow' &&
107
-				$notification->getObjectType() !== 'share')) {
108
-			throw new \InvalidArgumentException('Unhandled app or subject');
109
-		}
96
+    /**
97
+     * @param INotification $notification
98
+     * @param string $languageCode The code of the language that should be used to prepare the notification
99
+     * @return INotification
100
+     * @throws \InvalidArgumentException When the notification was not prepared by a notifier
101
+     * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted
102
+     * @since 9.0.0
103
+     */
104
+    public function prepare(INotification $notification, string $languageCode): INotification {
105
+        if ($notification->getApp() !== 'files_sharing' ||
106
+            ($notification->getSubject() !== 'expiresTomorrow' &&
107
+                $notification->getObjectType() !== 'share')) {
108
+            throw new \InvalidArgumentException('Unhandled app or subject');
109
+        }
110 110
 
111
-		$l = $this->l10nFactory->get('files_sharing', $languageCode);
112
-		$attemptId = $notification->getObjectId();
111
+        $l = $this->l10nFactory->get('files_sharing', $languageCode);
112
+        $attemptId = $notification->getObjectId();
113 113
 
114
-		try {
115
-			$share = $this->shareManager->getShareById($attemptId, $notification->getUser());
116
-		} catch (ShareNotFound $e) {
117
-			throw new AlreadyProcessedException();
118
-		}
114
+        try {
115
+            $share = $this->shareManager->getShareById($attemptId, $notification->getUser());
116
+        } catch (ShareNotFound $e) {
117
+            throw new AlreadyProcessedException();
118
+        }
119 119
 
120
-		if ($notification->getSubject() === 'expiresTomorrow') {
121
-			$notification = $this->parseShareExpiration($share, $notification, $l);
122
-		} else {
123
-			$notification = $this->parseShareInvitation($share, $notification, $l);
124
-		}
125
-		return $notification;
126
-	}
120
+        if ($notification->getSubject() === 'expiresTomorrow') {
121
+            $notification = $this->parseShareExpiration($share, $notification, $l);
122
+        } else {
123
+            $notification = $this->parseShareInvitation($share, $notification, $l);
124
+        }
125
+        return $notification;
126
+    }
127 127
 
128
-	protected function parseShareExpiration(IShare $share, INotification $notification, IL10N $l): INotification {
129
-		$node = $share->getNode();
130
-		$userFolder = $this->rootFolder->getUserFolder($notification->getUser());
131
-		$path = $userFolder->getRelativePath($node->getPath());
128
+    protected function parseShareExpiration(IShare $share, INotification $notification, IL10N $l): INotification {
129
+        $node = $share->getNode();
130
+        $userFolder = $this->rootFolder->getUserFolder($notification->getUser());
131
+        $path = $userFolder->getRelativePath($node->getPath());
132 132
 
133
-		$notification
134
-			->setParsedSubject($l->t('Share will expire tomorrow'))
135
-			->setParsedMessage($l->t('One or more of your shares will expire tomorrow'))
136
-			->setRichMessage(
137
-				$l->t('Your share of {node} will expire tomorrow'),
138
-				[
139
-					'node' => [
140
-						'type' => 'file',
141
-						'id' => $node->getId(),
142
-						'name' => $node->getName(),
143
-						'path' => $path,
144
-					],
145
-				]
146
-			);
133
+        $notification
134
+            ->setParsedSubject($l->t('Share will expire tomorrow'))
135
+            ->setParsedMessage($l->t('One or more of your shares will expire tomorrow'))
136
+            ->setRichMessage(
137
+                $l->t('Your share of {node} will expire tomorrow'),
138
+                [
139
+                    'node' => [
140
+                        'type' => 'file',
141
+                        'id' => $node->getId(),
142
+                        'name' => $node->getName(),
143
+                        'path' => $path,
144
+                    ],
145
+                ]
146
+            );
147 147
 
148
-		return $notification;
149
-	}
148
+        return $notification;
149
+    }
150 150
 
151
-	protected function parseShareInvitation(IShare $share, INotification $notification, IL10N $l): INotification {
152
-		if ($share->getShareType() === IShare::TYPE_USER) {
153
-			if ($share->getStatus() !== IShare::STATUS_PENDING) {
154
-				throw new AlreadyProcessedException();
155
-			}
156
-		} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
157
-			if ($share->getStatus() !== IShare::STATUS_PENDING) {
158
-				throw new AlreadyProcessedException();
159
-			}
160
-		}
151
+    protected function parseShareInvitation(IShare $share, INotification $notification, IL10N $l): INotification {
152
+        if ($share->getShareType() === IShare::TYPE_USER) {
153
+            if ($share->getStatus() !== IShare::STATUS_PENDING) {
154
+                throw new AlreadyProcessedException();
155
+            }
156
+        } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
157
+            if ($share->getStatus() !== IShare::STATUS_PENDING) {
158
+                throw new AlreadyProcessedException();
159
+            }
160
+        }
161 161
 
162
-		switch ($notification->getSubject()) {
163
-			case self::INCOMING_USER_SHARE:
164
-				if ($share->getSharedWith() !== $notification->getUser()) {
165
-					throw new AlreadyProcessedException();
166
-				}
162
+        switch ($notification->getSubject()) {
163
+            case self::INCOMING_USER_SHARE:
164
+                if ($share->getSharedWith() !== $notification->getUser()) {
165
+                    throw new AlreadyProcessedException();
166
+                }
167 167
 
168
-				$sharer = $this->userManager->get($share->getSharedBy());
169
-				if (!$sharer instanceof IUser) {
170
-					throw new \InvalidArgumentException('Temporary failure');
171
-				}
168
+                $sharer = $this->userManager->get($share->getSharedBy());
169
+                if (!$sharer instanceof IUser) {
170
+                    throw new \InvalidArgumentException('Temporary failure');
171
+                }
172 172
 
173
-				$subject = $l->t('You received {share} as a share by {user}');
174
-				$subjectParameters = [
175
-					'share' => [
176
-						'type' => 'highlight',
177
-						'id' => $notification->getObjectId(),
178
-						'name' => $share->getTarget(),
179
-					],
180
-					'user' => [
181
-						'type' => 'user',
182
-						'id' => $sharer->getUID(),
183
-						'name' => $sharer->getDisplayName(),
184
-					],
185
-				];
186
-				break;
173
+                $subject = $l->t('You received {share} as a share by {user}');
174
+                $subjectParameters = [
175
+                    'share' => [
176
+                        'type' => 'highlight',
177
+                        'id' => $notification->getObjectId(),
178
+                        'name' => $share->getTarget(),
179
+                    ],
180
+                    'user' => [
181
+                        'type' => 'user',
182
+                        'id' => $sharer->getUID(),
183
+                        'name' => $sharer->getDisplayName(),
184
+                    ],
185
+                ];
186
+                break;
187 187
 
188
-			case self::INCOMING_GROUP_SHARE:
189
-				$user = $this->userManager->get($notification->getUser());
190
-				if (!$user instanceof IUser) {
191
-					throw new AlreadyProcessedException();
192
-				}
188
+            case self::INCOMING_GROUP_SHARE:
189
+                $user = $this->userManager->get($notification->getUser());
190
+                if (!$user instanceof IUser) {
191
+                    throw new AlreadyProcessedException();
192
+                }
193 193
 
194
-				$group = $this->groupManager->get($share->getSharedWith());
195
-				if ($group === null || !$group->inGroup($user)) {
196
-					throw new AlreadyProcessedException();
197
-				}
194
+                $group = $this->groupManager->get($share->getSharedWith());
195
+                if ($group === null || !$group->inGroup($user)) {
196
+                    throw new AlreadyProcessedException();
197
+                }
198 198
 
199
-				if ($share->getPermissions() === 0) {
200
-					// Already rejected
201
-					throw new AlreadyProcessedException();
202
-				}
199
+                if ($share->getPermissions() === 0) {
200
+                    // Already rejected
201
+                    throw new AlreadyProcessedException();
202
+                }
203 203
 
204
-				$sharer = $this->userManager->get($share->getSharedBy());
205
-				if (!$sharer instanceof IUser) {
206
-					throw new \InvalidArgumentException('Temporary failure');
207
-				}
204
+                $sharer = $this->userManager->get($share->getSharedBy());
205
+                if (!$sharer instanceof IUser) {
206
+                    throw new \InvalidArgumentException('Temporary failure');
207
+                }
208 208
 
209
-				$subject = $l->t('You received {share} to group {group} as a share by {user}');
210
-				$subjectParameters = [
211
-					'share' => [
212
-						'type' => 'highlight',
213
-						'id' => $notification->getObjectId(),
214
-						'name' => $share->getTarget(),
215
-					],
216
-					'group' => [
217
-						'type' => 'user-group',
218
-						'id' => $group->getGID(),
219
-						'name' => $group->getDisplayName(),
220
-					],
221
-					'user' => [
222
-						'type' => 'user',
223
-						'id' => $sharer->getUID(),
224
-						'name' => $sharer->getDisplayName(),
225
-					],
226
-				];
227
-				break;
209
+                $subject = $l->t('You received {share} to group {group} as a share by {user}');
210
+                $subjectParameters = [
211
+                    'share' => [
212
+                        'type' => 'highlight',
213
+                        'id' => $notification->getObjectId(),
214
+                        'name' => $share->getTarget(),
215
+                    ],
216
+                    'group' => [
217
+                        'type' => 'user-group',
218
+                        'id' => $group->getGID(),
219
+                        'name' => $group->getDisplayName(),
220
+                    ],
221
+                    'user' => [
222
+                        'type' => 'user',
223
+                        'id' => $sharer->getUID(),
224
+                        'name' => $sharer->getDisplayName(),
225
+                    ],
226
+                ];
227
+                break;
228 228
 
229
-			default:
230
-				throw new \InvalidArgumentException('Invalid subject');
231
-		}
229
+            default:
230
+                throw new \InvalidArgumentException('Invalid subject');
231
+        }
232 232
 
233
-		$placeholders = $replacements = [];
234
-		foreach ($subjectParameters as $placeholder => $parameter) {
235
-			$placeholders[] = '{' . $placeholder . '}';
236
-			$replacements[] = $parameter['name'];
237
-		}
233
+        $placeholders = $replacements = [];
234
+        foreach ($subjectParameters as $placeholder => $parameter) {
235
+            $placeholders[] = '{' . $placeholder . '}';
236
+            $replacements[] = $parameter['name'];
237
+        }
238 238
 
239
-		$notification->setParsedSubject(str_replace($placeholders, $replacements, $subject))
240
-			->setRichSubject($subject, $subjectParameters)
241
-			->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
239
+        $notification->setParsedSubject(str_replace($placeholders, $replacements, $subject))
240
+            ->setRichSubject($subject, $subjectParameters)
241
+            ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
242 242
 
243
-		$acceptAction = $notification->createAction();
244
-		$acceptAction->setParsedLabel($l->t('Accept'))
245
-			->setLink($this->url->linkToOCSRouteAbsolute('files_sharing.ShareAPI.acceptShare', ['id' => $share->getId()]), 'POST')
246
-			->setPrimary(true);
247
-		$notification->addParsedAction($acceptAction);
243
+        $acceptAction = $notification->createAction();
244
+        $acceptAction->setParsedLabel($l->t('Accept'))
245
+            ->setLink($this->url->linkToOCSRouteAbsolute('files_sharing.ShareAPI.acceptShare', ['id' => $share->getId()]), 'POST')
246
+            ->setPrimary(true);
247
+        $notification->addParsedAction($acceptAction);
248 248
 
249
-		$rejectAction = $notification->createAction();
250
-		$rejectAction->setParsedLabel($l->t('Reject'))
251
-			->setLink($this->url->linkToOCSRouteAbsolute('files_sharing.ShareAPI.deleteShare', ['id' => $share->getId()]), 'DELETE')
252
-			->setPrimary(false);
253
-		$notification->addParsedAction($rejectAction);
249
+        $rejectAction = $notification->createAction();
250
+        $rejectAction->setParsedLabel($l->t('Reject'))
251
+            ->setLink($this->url->linkToOCSRouteAbsolute('files_sharing.ShareAPI.deleteShare', ['id' => $share->getId()]), 'DELETE')
252
+            ->setPrimary(false);
253
+        $notification->addParsedAction($rejectAction);
254 254
 
255
-		return $notification;
256
-	}
255
+        return $notification;
256
+    }
257 257
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Migration/SetAcceptedStatus.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -33,47 +33,47 @@
 block discarded – undo
33 33
 
34 34
 class SetAcceptedStatus implements IRepairStep {
35 35
 
36
-	/** @var IDBConnection */
37
-	private $connection;
36
+    /** @var IDBConnection */
37
+    private $connection;
38 38
 
39
-	/** @var  IConfig */
40
-	private $config;
39
+    /** @var  IConfig */
40
+    private $config;
41 41
 
42 42
 
43
-	public function __construct(IDBConnection $connection, IConfig $config) {
44
-		$this->connection = $connection;
45
-		$this->config = $config;
46
-	}
43
+    public function __construct(IDBConnection $connection, IConfig $config) {
44
+        $this->connection = $connection;
45
+        $this->config = $config;
46
+    }
47 47
 
48
-	/**
49
-	 * Returns the step's name
50
-	 *
51
-	 * @return string
52
-	 * @since 9.1.0
53
-	 */
54
-	public function getName(): string {
55
-		return 'Set existing shares as accepted';
56
-	}
48
+    /**
49
+     * Returns the step's name
50
+     *
51
+     * @return string
52
+     * @since 9.1.0
53
+     */
54
+    public function getName(): string {
55
+        return 'Set existing shares as accepted';
56
+    }
57 57
 
58
-	/**
59
-	 * @param IOutput $output
60
-	 */
61
-	public function run(IOutput $output): void {
62
-		if (!$this->shouldRun()) {
63
-			return;
64
-		}
58
+    /**
59
+     * @param IOutput $output
60
+     */
61
+    public function run(IOutput $output): void {
62
+        if (!$this->shouldRun()) {
63
+            return;
64
+        }
65 65
 
66
-		$query = $this->connection->getQueryBuilder();
67
-		$query
68
-			->update('share')
69
-			->set('accepted', $query->createNamedParameter(IShare::STATUS_ACCEPTED))
70
-			->where($query->expr()->in('share_type', $query->createNamedParameter([IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_USERGROUP], IQueryBuilder::PARAM_INT_ARRAY)));
71
-		$query->execute();
72
-	}
66
+        $query = $this->connection->getQueryBuilder();
67
+        $query
68
+            ->update('share')
69
+            ->set('accepted', $query->createNamedParameter(IShare::STATUS_ACCEPTED))
70
+            ->where($query->expr()->in('share_type', $query->createNamedParameter([IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_USERGROUP], IQueryBuilder::PARAM_INT_ARRAY)));
71
+        $query->execute();
72
+    }
73 73
 
74
-	protected function shouldRun() {
75
-		$appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
76
-		return version_compare($appVersion, '1.10.1', '<');
77
-	}
74
+    protected function shouldRun() {
75
+        $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
76
+        return version_compare($appVersion, '1.10.1', '<');
77
+    }
78 78
 
79 79
 }
Please login to merge, or discard this patch.