Passed
Push — master ( 4908d8...fbbdc6 )
by Joas
16:12 queued 12s
created
apps/files/lib/BackgroundJob/TransferOwnership.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -42,141 +42,141 @@
 block discarded – undo
42 42
 
43 43
 class TransferOwnership extends QueuedJob {
44 44
 
45
-	/** @var IUserManager $userManager */
46
-	private $userManager;
47
-
48
-	/** @var OwnershipTransferService */
49
-	private $transferService;
50
-
51
-	/** @var ILogger */
52
-	private $logger;
53
-
54
-	/** @var NotificationManager */
55
-	private $notificationManager;
56
-
57
-	/** @var TransferOwnershipMapper */
58
-	private $mapper;
59
-	/** @var IRootFolder */
60
-	private $rootFolder;
61
-
62
-	public function __construct(ITimeFactory $timeFactory,
63
-								IUserManager $userManager,
64
-								OwnershipTransferService $transferService,
65
-								ILogger $logger,
66
-								NotificationManager $notificationManager,
67
-								TransferOwnershipMapper $mapper,
68
-								IRootFolder $rootFolder) {
69
-		parent::__construct($timeFactory);
70
-
71
-		$this->userManager = $userManager;
72
-		$this->transferService = $transferService;
73
-		$this->logger = $logger;
74
-		$this->notificationManager = $notificationManager;
75
-		$this->mapper = $mapper;
76
-		$this->rootFolder = $rootFolder;
77
-	}
78
-
79
-	protected function run($argument) {
80
-		$id = $argument['id'];
81
-
82
-		$transfer = $this->mapper->getById($id);
83
-		$sourceUser = $transfer->getSourceUser();
84
-		$destinationUser = $transfer->getTargetUser();
85
-		$fileId = $transfer->getFileId();
86
-
87
-		$userFolder = $this->rootFolder->getUserFolder($sourceUser);
88
-		$nodes = $userFolder->getById($fileId);
89
-
90
-		if (empty($nodes)) {
91
-			$this->logger->alert('Could not transfer ownership: Node not found');
92
-			$this->failedNotication($transfer);
93
-			return;
94
-		}
95
-		$path = $userFolder->getRelativePath($nodes[0]->getPath());
96
-
97
-		$sourceUserObject = $this->userManager->get($sourceUser);
98
-		$destinationUserObject = $this->userManager->get($destinationUser);
99
-
100
-		if (!$sourceUserObject instanceof IUser) {
101
-			$this->logger->alert('Could not transfer ownership: Unknown source user ' . $sourceUser);
102
-			$this->failedNotication($transfer);
103
-			return;
104
-		}
105
-
106
-		if (!$destinationUserObject instanceof IUser) {
107
-			$this->logger->alert("Unknown destination user $destinationUser");
108
-			$this->failedNotication($transfer);
109
-			return;
110
-		}
111
-
112
-		try {
113
-			$this->transferService->transfer(
114
-				$sourceUserObject,
115
-				$destinationUserObject,
116
-				ltrim($path, '/')
117
-			);
118
-			$this->successNotification($transfer);
119
-		} catch (TransferOwnershipException $e) {
120
-			$this->logger->logException($e);
121
-			$this->failedNotication($transfer);
122
-		}
123
-
124
-		$this->mapper->delete($transfer);
125
-	}
126
-
127
-	private function failedNotication(Transfer $transfer): void {
128
-		// Send notification to source user
129
-		$notification = $this->notificationManager->createNotification();
130
-		$notification->setUser($transfer->getSourceUser())
131
-			->setApp(Application::APP_ID)
132
-			->setDateTime($this->time->getDateTime())
133
-			->setSubject('transferOwnershipFailedSource', [
134
-				'sourceUser' => $transfer->getSourceUser(),
135
-				'targetUser' => $transfer->getTargetUser(),
136
-				'nodeName' => $transfer->getNodeName(),
137
-			])
138
-			->setObject('transfer', (string)$transfer->getId());
139
-		$this->notificationManager->notify($notification);
140
-
141
-		// Send notification to source user
142
-		$notification = $this->notificationManager->createNotification();
143
-		$notification->setUser($transfer->getTargetUser())
144
-			->setApp(Application::APP_ID)
145
-			->setDateTime($this->time->getDateTime())
146
-			->setSubject('transferOwnershipFailedTarget', [
147
-				'sourceUser' => $transfer->getSourceUser(),
148
-				'targetUser' => $transfer->getTargetUser(),
149
-				'nodeName' => $transfer->getNodeName(),
150
-			])
151
-			->setObject('transfer', (string)$transfer->getId());
152
-		$this->notificationManager->notify($notification);
153
-	}
154
-
155
-	private function successNotification(Transfer $transfer): void {
156
-		// Send notification to source user
157
-		$notification = $this->notificationManager->createNotification();
158
-		$notification->setUser($transfer->getSourceUser())
159
-			->setApp(Application::APP_ID)
160
-			->setDateTime($this->time->getDateTime())
161
-			->setSubject('transferOwnershipDoneSource', [
162
-				'sourceUser' => $transfer->getSourceUser(),
163
-				'targetUser' => $transfer->getTargetUser(),
164
-				'nodeName' => $transfer->getNodeName(),
165
-			])
166
-			->setObject('transfer', (string)$transfer->getId());
167
-		$this->notificationManager->notify($notification);
168
-
169
-		// Send notification to source user
170
-		$notification = $this->notificationManager->createNotification();
171
-		$notification->setUser($transfer->getTargetUser())
172
-			->setApp(Application::APP_ID)
173
-			->setDateTime($this->time->getDateTime())
174
-			->setSubject('transferOwnershipDoneTarget', [
175
-				'sourceUser' => $transfer->getSourceUser(),
176
-				'targetUser' => $transfer->getTargetUser(),
177
-				'nodeName' => $transfer->getNodeName(),
178
-			])
179
-			->setObject('transfer', (string)$transfer->getId());
180
-		$this->notificationManager->notify($notification);
181
-	}
45
+    /** @var IUserManager $userManager */
46
+    private $userManager;
47
+
48
+    /** @var OwnershipTransferService */
49
+    private $transferService;
50
+
51
+    /** @var ILogger */
52
+    private $logger;
53
+
54
+    /** @var NotificationManager */
55
+    private $notificationManager;
56
+
57
+    /** @var TransferOwnershipMapper */
58
+    private $mapper;
59
+    /** @var IRootFolder */
60
+    private $rootFolder;
61
+
62
+    public function __construct(ITimeFactory $timeFactory,
63
+                                IUserManager $userManager,
64
+                                OwnershipTransferService $transferService,
65
+                                ILogger $logger,
66
+                                NotificationManager $notificationManager,
67
+                                TransferOwnershipMapper $mapper,
68
+                                IRootFolder $rootFolder) {
69
+        parent::__construct($timeFactory);
70
+
71
+        $this->userManager = $userManager;
72
+        $this->transferService = $transferService;
73
+        $this->logger = $logger;
74
+        $this->notificationManager = $notificationManager;
75
+        $this->mapper = $mapper;
76
+        $this->rootFolder = $rootFolder;
77
+    }
78
+
79
+    protected function run($argument) {
80
+        $id = $argument['id'];
81
+
82
+        $transfer = $this->mapper->getById($id);
83
+        $sourceUser = $transfer->getSourceUser();
84
+        $destinationUser = $transfer->getTargetUser();
85
+        $fileId = $transfer->getFileId();
86
+
87
+        $userFolder = $this->rootFolder->getUserFolder($sourceUser);
88
+        $nodes = $userFolder->getById($fileId);
89
+
90
+        if (empty($nodes)) {
91
+            $this->logger->alert('Could not transfer ownership: Node not found');
92
+            $this->failedNotication($transfer);
93
+            return;
94
+        }
95
+        $path = $userFolder->getRelativePath($nodes[0]->getPath());
96
+
97
+        $sourceUserObject = $this->userManager->get($sourceUser);
98
+        $destinationUserObject = $this->userManager->get($destinationUser);
99
+
100
+        if (!$sourceUserObject instanceof IUser) {
101
+            $this->logger->alert('Could not transfer ownership: Unknown source user ' . $sourceUser);
102
+            $this->failedNotication($transfer);
103
+            return;
104
+        }
105
+
106
+        if (!$destinationUserObject instanceof IUser) {
107
+            $this->logger->alert("Unknown destination user $destinationUser");
108
+            $this->failedNotication($transfer);
109
+            return;
110
+        }
111
+
112
+        try {
113
+            $this->transferService->transfer(
114
+                $sourceUserObject,
115
+                $destinationUserObject,
116
+                ltrim($path, '/')
117
+            );
118
+            $this->successNotification($transfer);
119
+        } catch (TransferOwnershipException $e) {
120
+            $this->logger->logException($e);
121
+            $this->failedNotication($transfer);
122
+        }
123
+
124
+        $this->mapper->delete($transfer);
125
+    }
126
+
127
+    private function failedNotication(Transfer $transfer): void {
128
+        // Send notification to source user
129
+        $notification = $this->notificationManager->createNotification();
130
+        $notification->setUser($transfer->getSourceUser())
131
+            ->setApp(Application::APP_ID)
132
+            ->setDateTime($this->time->getDateTime())
133
+            ->setSubject('transferOwnershipFailedSource', [
134
+                'sourceUser' => $transfer->getSourceUser(),
135
+                'targetUser' => $transfer->getTargetUser(),
136
+                'nodeName' => $transfer->getNodeName(),
137
+            ])
138
+            ->setObject('transfer', (string)$transfer->getId());
139
+        $this->notificationManager->notify($notification);
140
+
141
+        // Send notification to source user
142
+        $notification = $this->notificationManager->createNotification();
143
+        $notification->setUser($transfer->getTargetUser())
144
+            ->setApp(Application::APP_ID)
145
+            ->setDateTime($this->time->getDateTime())
146
+            ->setSubject('transferOwnershipFailedTarget', [
147
+                'sourceUser' => $transfer->getSourceUser(),
148
+                'targetUser' => $transfer->getTargetUser(),
149
+                'nodeName' => $transfer->getNodeName(),
150
+            ])
151
+            ->setObject('transfer', (string)$transfer->getId());
152
+        $this->notificationManager->notify($notification);
153
+    }
154
+
155
+    private function successNotification(Transfer $transfer): void {
156
+        // Send notification to source user
157
+        $notification = $this->notificationManager->createNotification();
158
+        $notification->setUser($transfer->getSourceUser())
159
+            ->setApp(Application::APP_ID)
160
+            ->setDateTime($this->time->getDateTime())
161
+            ->setSubject('transferOwnershipDoneSource', [
162
+                'sourceUser' => $transfer->getSourceUser(),
163
+                'targetUser' => $transfer->getTargetUser(),
164
+                'nodeName' => $transfer->getNodeName(),
165
+            ])
166
+            ->setObject('transfer', (string)$transfer->getId());
167
+        $this->notificationManager->notify($notification);
168
+
169
+        // Send notification to source user
170
+        $notification = $this->notificationManager->createNotification();
171
+        $notification->setUser($transfer->getTargetUser())
172
+            ->setApp(Application::APP_ID)
173
+            ->setDateTime($this->time->getDateTime())
174
+            ->setSubject('transferOwnershipDoneTarget', [
175
+                'sourceUser' => $transfer->getSourceUser(),
176
+                'targetUser' => $transfer->getTargetUser(),
177
+                'nodeName' => $transfer->getNodeName(),
178
+            ])
179
+            ->setObject('transfer', (string)$transfer->getId());
180
+        $this->notificationManager->notify($notification);
181
+    }
182 182
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Integration/ExternalCalendar.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -33,99 +33,99 @@
 block discarded – undo
33 33
  */
34 34
 abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
35 35
 
36
-	/** @var string */
37
-	private const PREFIX = 'app-generated';
36
+    /** @var string */
37
+    private const PREFIX = 'app-generated';
38 38
 
39
-	/**
40
-	 * @var string
41
-	 *
42
-	 * Double dash is a valid delimiter,
43
-	 * because it will always split the calendarURIs correctly:
44
-	 * - our prefix contains only one dash and won't be split
45
-	 * - appIds are not allowed to contain dashes as per spec:
46
-	 * > must contain only lowercase ASCII characters and underscore
47
-	 * - explode has a limit of three, so even if the app-generated
48
-	 *   calendar uri has double dashes, it won't be split
49
-	 */
50
-	private const DELIMITER = '--';
39
+    /**
40
+     * @var string
41
+     *
42
+     * Double dash is a valid delimiter,
43
+     * because it will always split the calendarURIs correctly:
44
+     * - our prefix contains only one dash and won't be split
45
+     * - appIds are not allowed to contain dashes as per spec:
46
+     * > must contain only lowercase ASCII characters and underscore
47
+     * - explode has a limit of three, so even if the app-generated
48
+     *   calendar uri has double dashes, it won't be split
49
+     */
50
+    private const DELIMITER = '--';
51 51
 
52
-	/** @var string */
53
-	private $appId;
52
+    /** @var string */
53
+    private $appId;
54 54
 
55
-	/** @var string */
56
-	private $calendarUri;
55
+    /** @var string */
56
+    private $calendarUri;
57 57
 
58
-	/**
59
-	 * ExternalCalendar constructor.
60
-	 *
61
-	 * @param string $appId
62
-	 * @param string $calendarUri
63
-	 */
64
-	public function __construct(string $appId, string $calendarUri) {
65
-		$this->appId = $appId;
66
-		$this->calendarUri = $calendarUri;
67
-	}
58
+    /**
59
+     * ExternalCalendar constructor.
60
+     *
61
+     * @param string $appId
62
+     * @param string $calendarUri
63
+     */
64
+    public function __construct(string $appId, string $calendarUri) {
65
+        $this->appId = $appId;
66
+        $this->calendarUri = $calendarUri;
67
+    }
68 68
 
69
-	/**
70
-	 * @inheritDoc
71
-	 */
72
-	final public function getName() {
73
-		return implode(self::DELIMITER, [
74
-			self::PREFIX,
75
-			$this->appId,
76
-			$this->calendarUri,
77
-		]);
78
-	}
69
+    /**
70
+     * @inheritDoc
71
+     */
72
+    final public function getName() {
73
+        return implode(self::DELIMITER, [
74
+            self::PREFIX,
75
+            $this->appId,
76
+            $this->calendarUri,
77
+        ]);
78
+    }
79 79
 
80
-	/**
81
-	 * @inheritDoc
82
-	 */
83
-	final public function setName($name) {
84
-		throw new DAV\Exception\MethodNotAllowed('Renaming calendars is not yet supported');
85
-	}
80
+    /**
81
+     * @inheritDoc
82
+     */
83
+    final public function setName($name) {
84
+        throw new DAV\Exception\MethodNotAllowed('Renaming calendars is not yet supported');
85
+    }
86 86
 
87
-	/**
88
-	 * @inheritDoc
89
-	 */
90
-	final public function createDirectory($name) {
91
-		throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
92
-	}
87
+    /**
88
+     * @inheritDoc
89
+     */
90
+    final public function createDirectory($name) {
91
+        throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
92
+    }
93 93
 
94
-	/**
95
-	 * Checks whether the calendar uri is app-generated
96
-	 *
97
-	 * @param string $calendarUri
98
-	 * @return bool
99
-	 */
100
-	public static function isAppGeneratedCalendar(string $calendarUri):bool {
101
-		return strpos($calendarUri, self::PREFIX) === 0 && substr_count($calendarUri, self::DELIMITER) >= 2;
102
-	}
94
+    /**
95
+     * Checks whether the calendar uri is app-generated
96
+     *
97
+     * @param string $calendarUri
98
+     * @return bool
99
+     */
100
+    public static function isAppGeneratedCalendar(string $calendarUri):bool {
101
+        return strpos($calendarUri, self::PREFIX) === 0 && substr_count($calendarUri, self::DELIMITER) >= 2;
102
+    }
103 103
 
104
-	/**
105
-	 * Splits an app-generated calendar-uri into appId and calendarUri
106
-	 *
107
-	 * @param string $calendarUri
108
-	 * @return array
109
-	 */
110
-	public static function splitAppGeneratedCalendarUri(string $calendarUri):array {
111
-		$array = array_slice(explode(self::DELIMITER, $calendarUri, 3), 1);
112
-		// Check the array has expected amount of elements
113
-		// and none of them is an empty string
114
-		if (\count($array) !== 2 || \in_array('', $array, true)) {
115
-			throw new \InvalidArgumentException('Provided calendar uri was not app-generated');
116
-		}
104
+    /**
105
+     * Splits an app-generated calendar-uri into appId and calendarUri
106
+     *
107
+     * @param string $calendarUri
108
+     * @return array
109
+     */
110
+    public static function splitAppGeneratedCalendarUri(string $calendarUri):array {
111
+        $array = array_slice(explode(self::DELIMITER, $calendarUri, 3), 1);
112
+        // Check the array has expected amount of elements
113
+        // and none of them is an empty string
114
+        if (\count($array) !== 2 || \in_array('', $array, true)) {
115
+            throw new \InvalidArgumentException('Provided calendar uri was not app-generated');
116
+        }
117 117
 
118
-		return $array;
119
-	}
118
+        return $array;
119
+    }
120 120
 
121
-	/**
122
-	 * Checks whether a calendar-name, the user wants to create, violates
123
-	 * the reserved name for calendar uris
124
-	 *
125
-	 * @param string $calendarUri
126
-	 * @return bool
127
-	 */
128
-	public static function doesViolateReservedName(string $calendarUri):bool {
129
-		return strpos($calendarUri, self::PREFIX) === 0;
130
-	}
121
+    /**
122
+     * Checks whether a calendar-name, the user wants to create, violates
123
+     * the reserved name for calendar uris
124
+     *
125
+     * @param string $calendarUri
126
+     * @return bool
127
+     */
128
+    public static function doesViolateReservedName(string $calendarUri):bool {
129
+        return strpos($calendarUri, self::PREFIX) === 0;
130
+    }
131 131
 }
Please login to merge, or discard this patch.
apps/dav/lib/Files/Sharing/FilesDropPlugin.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -35,51 +35,51 @@
 block discarded – undo
35 35
  */
36 36
 class FilesDropPlugin extends ServerPlugin {
37 37
 
38
-	/** @var View */
39
-	private $view;
38
+    /** @var View */
39
+    private $view;
40 40
 
41
-	/** @var bool */
42
-	private $enabled = false;
41
+    /** @var bool */
42
+    private $enabled = false;
43 43
 
44
-	/**
45
-	 * @param View $view
46
-	 */
47
-	public function setView($view) {
48
-		$this->view = $view;
49
-	}
44
+    /**
45
+     * @param View $view
46
+     */
47
+    public function setView($view) {
48
+        $this->view = $view;
49
+    }
50 50
 
51
-	public function enable() {
52
-		$this->enabled = true;
53
-	}
51
+    public function enable() {
52
+        $this->enabled = true;
53
+    }
54 54
 
55 55
 
56
-	/**
57
-	 * This initializes the plugin.
58
-	 *
59
-	 * @param \Sabre\DAV\Server $server Sabre server
60
-	 *
61
-	 * @return void
62
-	 * @throws MethodNotAllowed
63
-	 */
64
-	public function initialize(\Sabre\DAV\Server $server) {
65
-		$server->on('beforeMethod:*', [$this, 'beforeMethod'], 999);
66
-		$this->enabled = false;
67
-	}
56
+    /**
57
+     * This initializes the plugin.
58
+     *
59
+     * @param \Sabre\DAV\Server $server Sabre server
60
+     *
61
+     * @return void
62
+     * @throws MethodNotAllowed
63
+     */
64
+    public function initialize(\Sabre\DAV\Server $server) {
65
+        $server->on('beforeMethod:*', [$this, 'beforeMethod'], 999);
66
+        $this->enabled = false;
67
+    }
68 68
 
69
-	public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
70
-		if (!$this->enabled) {
71
-			return;
72
-		}
69
+    public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
70
+        if (!$this->enabled) {
71
+            return;
72
+        }
73 73
 
74
-		if ($request->getMethod() !== 'PUT') {
75
-			throw new MethodNotAllowed('Only PUT is allowed on files drop');
76
-		}
74
+        if ($request->getMethod() !== 'PUT') {
75
+            throw new MethodNotAllowed('Only PUT is allowed on files drop');
76
+        }
77 77
 
78
-		$path = explode('/', $request->getPath());
79
-		$path = array_pop($path);
78
+        $path = explode('/', $request->getPath());
79
+        $path = array_pop($path);
80 80
 
81
-		$newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
82
-		$url = $request->getBaseUrl() . $newName;
83
-		$request->setUrl($url);
84
-	}
81
+        $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
82
+        $url = $request->getBaseUrl() . $newName;
83
+        $request->setUrl($url);
84
+    }
85 85
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -34,52 +34,52 @@
 block discarded – undo
34 34
 
35 35
 class RefreshWebcalJobRegistrar implements IRepairStep {
36 36
 
37
-	/** @var IDBConnection */
38
-	private $connection;
37
+    /** @var IDBConnection */
38
+    private $connection;
39 39
 
40
-	/** @var IJobList */
41
-	private $jobList;
40
+    /** @var IJobList */
41
+    private $jobList;
42 42
 
43
-	/**
44
-	 * FixBirthdayCalendarComponent constructor.
45
-	 *
46
-	 * @param IDBConnection $connection
47
-	 * @param IJobList $jobList
48
-	 */
49
-	public function __construct(IDBConnection $connection, IJobList $jobList) {
50
-		$this->connection = $connection;
51
-		$this->jobList = $jobList;
52
-	}
43
+    /**
44
+     * FixBirthdayCalendarComponent constructor.
45
+     *
46
+     * @param IDBConnection $connection
47
+     * @param IJobList $jobList
48
+     */
49
+    public function __construct(IDBConnection $connection, IJobList $jobList) {
50
+        $this->connection = $connection;
51
+        $this->jobList = $jobList;
52
+    }
53 53
 
54
-	/**
55
-	 * @inheritdoc
56
-	 */
57
-	public function getName() {
58
-		return 'Registering background jobs to update cache for webcal calendars';
59
-	}
54
+    /**
55
+     * @inheritdoc
56
+     */
57
+    public function getName() {
58
+        return 'Registering background jobs to update cache for webcal calendars';
59
+    }
60 60
 
61
-	/**
62
-	 * @inheritdoc
63
-	 */
64
-	public function run(IOutput $output) {
65
-		$query = $this->connection->getQueryBuilder();
66
-		$query->select(['principaluri', 'uri'])
67
-			->from('calendarsubscriptions');
68
-		$stmt = $query->execute();
61
+    /**
62
+     * @inheritdoc
63
+     */
64
+    public function run(IOutput $output) {
65
+        $query = $this->connection->getQueryBuilder();
66
+        $query->select(['principaluri', 'uri'])
67
+            ->from('calendarsubscriptions');
68
+        $stmt = $query->execute();
69 69
 
70
-		$count = 0;
71
-		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
72
-			$args = [
73
-				'principaluri' => $row['principaluri'],
74
-				'uri' => $row['uri'],
75
-			];
70
+        $count = 0;
71
+        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
72
+            $args = [
73
+                'principaluri' => $row['principaluri'],
74
+                'uri' => $row['uri'],
75
+            ];
76 76
 
77
-			if (!$this->jobList->has(RefreshWebcalJob::class, $args)) {
78
-				$this->jobList->add(RefreshWebcalJob::class, $args);
79
-				$count++;
80
-			}
81
-		}
77
+            if (!$this->jobList->has(RefreshWebcalJob::class, $args)) {
78
+                $this->jobList->add(RefreshWebcalJob::class, $args);
79
+                $count++;
80
+            }
81
+        }
82 82
 
83
-		$output->info("Added $count background jobs to update webcal calendars");
84
-	}
83
+        $output->info("Added $count background jobs to update webcal calendars");
84
+    }
85 85
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Helper/ScopeContext.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -28,51 +28,51 @@
 block discarded – undo
28 28
 use OCP\WorkflowEngine\IManager;
29 29
 
30 30
 class ScopeContext {
31
-	/** @var int */
32
-	private $scope;
33
-	/** @var string */
34
-	private $scopeId;
35
-	/** @var string */
36
-	private $hash;
31
+    /** @var int */
32
+    private $scope;
33
+    /** @var string */
34
+    private $scopeId;
35
+    /** @var string */
36
+    private $hash;
37 37
 
38
-	public function __construct(int $scope, string $scopeId = null) {
39
-		$this->scope = $this->evaluateScope($scope);
40
-		$this->scopeId = $this->evaluateScopeId($scopeId);
41
-	}
38
+    public function __construct(int $scope, string $scopeId = null) {
39
+        $this->scope = $this->evaluateScope($scope);
40
+        $this->scopeId = $this->evaluateScopeId($scopeId);
41
+    }
42 42
 
43
-	private function evaluateScope(int $scope): int {
44
-		if (in_array($scope, [IManager::SCOPE_ADMIN, IManager::SCOPE_USER], true)) {
45
-			return $scope;
46
-		}
47
-		throw new \InvalidArgumentException('Invalid scope');
48
-	}
43
+    private function evaluateScope(int $scope): int {
44
+        if (in_array($scope, [IManager::SCOPE_ADMIN, IManager::SCOPE_USER], true)) {
45
+            return $scope;
46
+        }
47
+        throw new \InvalidArgumentException('Invalid scope');
48
+    }
49 49
 
50
-	private function evaluateScopeId(string $scopeId = null): string {
51
-		if ($this->scope === IManager::SCOPE_USER
52
-			&& trim((string)$scopeId) === '') {
53
-			throw new \InvalidArgumentException('user scope requires a user id');
54
-		}
55
-		return trim((string)$scopeId);
56
-	}
50
+    private function evaluateScopeId(string $scopeId = null): string {
51
+        if ($this->scope === IManager::SCOPE_USER
52
+            && trim((string)$scopeId) === '') {
53
+            throw new \InvalidArgumentException('user scope requires a user id');
54
+        }
55
+        return trim((string)$scopeId);
56
+    }
57 57
 
58
-	/**
59
-	 * @return int
60
-	 */
61
-	public function getScope(): int {
62
-		return $this->scope;
63
-	}
58
+    /**
59
+     * @return int
60
+     */
61
+    public function getScope(): int {
62
+        return $this->scope;
63
+    }
64 64
 
65
-	/**
66
-	 * @return string
67
-	 */
68
-	public function getScopeId(): string {
69
-		return $this->scopeId;
70
-	}
65
+    /**
66
+     * @return string
67
+     */
68
+    public function getScopeId(): string {
69
+        return $this->scopeId;
70
+    }
71 71
 
72
-	public function getHash(): string {
73
-		if ($this->hash === null) {
74
-			$this->hash = \hash('sha256', $this->getScope() . '::' . $this->getScopeId());
75
-		}
76
-		return $this->hash;
77
-	}
72
+    public function getHash(): string {
73
+        if ($this->hash === null) {
74
+            $this->hash = \hash('sha256', $this->getScope() . '::' . $this->getScopeId());
75
+        }
76
+        return $this->hash;
77
+    }
78 78
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Helper/LogContext.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -30,67 +30,67 @@
 block discarded – undo
30 30
 use OCP\WorkflowEngine\IOperation;
31 31
 
32 32
 class LogContext {
33
-	/** @var array */
34
-	protected $details;
33
+    /** @var array */
34
+    protected $details;
35 35
 
36
-	public function setDescription(string $description): LogContext {
37
-		$this->details['message'] = $description;
38
-		return $this;
39
-	}
36
+    public function setDescription(string $description): LogContext {
37
+        $this->details['message'] = $description;
38
+        return $this;
39
+    }
40 40
 
41
-	public function setScopes(array $scopes): LogContext {
42
-		$this->details['scopes'] = [];
43
-		foreach ($scopes as $scope) {
44
-			if ($scope instanceof ScopeContext) {
45
-				switch ($scope->getScope()) {
46
-					case IManager::SCOPE_ADMIN:
47
-						$this->details['scopes'][] = ['scope' => 'admin'];
48
-						break;
49
-					case IManager::SCOPE_USER:
50
-						$this->details['scopes'][] = [
51
-							'scope' => 'user',
52
-							'uid' => $scope->getScopeId(),
53
-						];
54
-						break;
55
-					default:
56
-						continue 2;
57
-				}
58
-			}
59
-		}
60
-		return $this;
61
-	}
41
+    public function setScopes(array $scopes): LogContext {
42
+        $this->details['scopes'] = [];
43
+        foreach ($scopes as $scope) {
44
+            if ($scope instanceof ScopeContext) {
45
+                switch ($scope->getScope()) {
46
+                    case IManager::SCOPE_ADMIN:
47
+                        $this->details['scopes'][] = ['scope' => 'admin'];
48
+                        break;
49
+                    case IManager::SCOPE_USER:
50
+                        $this->details['scopes'][] = [
51
+                            'scope' => 'user',
52
+                            'uid' => $scope->getScopeId(),
53
+                        ];
54
+                        break;
55
+                    default:
56
+                        continue 2;
57
+                }
58
+            }
59
+        }
60
+        return $this;
61
+    }
62 62
 
63
-	public function setOperation(?IOperation $operation): LogContext {
64
-		if ($operation instanceof IOperation) {
65
-			$this->details['operation'] = [
66
-				'class' => get_class($operation),
67
-				'name' => $operation->getDisplayName(),
68
-			];
69
-		}
70
-		return $this;
71
-	}
63
+    public function setOperation(?IOperation $operation): LogContext {
64
+        if ($operation instanceof IOperation) {
65
+            $this->details['operation'] = [
66
+                'class' => get_class($operation),
67
+                'name' => $operation->getDisplayName(),
68
+            ];
69
+        }
70
+        return $this;
71
+    }
72 72
 
73
-	public function setEntity(?IEntity $entity): LogContext {
74
-		if ($entity instanceof IEntity) {
75
-			$this->details['entity'] = [
76
-				'class' => get_class($entity),
77
-				'name' => $entity->getName(),
78
-			];
79
-		}
80
-		return $this;
81
-	}
73
+    public function setEntity(?IEntity $entity): LogContext {
74
+        if ($entity instanceof IEntity) {
75
+            $this->details['entity'] = [
76
+                'class' => get_class($entity),
77
+                'name' => $entity->getName(),
78
+            ];
79
+        }
80
+        return $this;
81
+    }
82 82
 
83
-	public function setConfiguration(array $configuration): LogContext {
84
-		$this->details['configuration'] = $configuration;
85
-		return $this;
86
-	}
83
+    public function setConfiguration(array $configuration): LogContext {
84
+        $this->details['configuration'] = $configuration;
85
+        return $this;
86
+    }
87 87
 
88
-	public function setEventName(string $eventName): LogContext {
89
-		$this->details['eventName'] = $eventName;
90
-		return $this;
91
-	}
88
+    public function setEventName(string $eventName): LogContext {
89
+        $this->details['eventName'] = $eventName;
90
+        return $this;
91
+    }
92 92
 
93
-	public function getDetails(): array {
94
-		return $this->details;
95
-	}
93
+    public function getDetails(): array {
94
+        return $this->details;
95
+    }
96 96
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Controller/GlobalWorkflowsController.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@
 block discarded – undo
30 30
 
31 31
 class GlobalWorkflowsController extends AWorkflowController {
32 32
 
33
-	/** @var ScopeContext */
34
-	private $scopeContext;
33
+    /** @var ScopeContext */
34
+    private $scopeContext;
35 35
 
36
-	protected function getScopeContext(): ScopeContext {
37
-		if ($this->scopeContext === null) {
38
-			$this->scopeContext = new ScopeContext(IManager::SCOPE_ADMIN);
39
-		}
40
-		return $this->scopeContext;
41
-	}
36
+    protected function getScopeContext(): ScopeContext {
37
+        if ($this->scopeContext === null) {
38
+            $this->scopeContext = new ScopeContext(IManager::SCOPE_ADMIN);
39
+        }
40
+        return $this->scopeContext;
41
+    }
42 42
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -38,47 +38,47 @@
 block discarded – undo
38 38
 
39 39
 class UserShareAcceptanceListener implements IEventListener {
40 40
 
41
-	/** @var IConfig */
42
-	private $config;
43
-	/** @var IManager */
44
-	private $shareManager;
45
-	/** @var IGroupManager */
46
-	private $groupManager;
41
+    /** @var IConfig */
42
+    private $config;
43
+    /** @var IManager */
44
+    private $shareManager;
45
+    /** @var IGroupManager */
46
+    private $groupManager;
47 47
 
48
-	public function __construct(IConfig $config, IManager $shareManager, IGroupManager $groupManager) {
49
-		$this->config = $config;
50
-		$this->shareManager = $shareManager;
51
-		$this->groupManager = $groupManager;
52
-	}
48
+    public function __construct(IConfig $config, IManager $shareManager, IGroupManager $groupManager) {
49
+        $this->config = $config;
50
+        $this->shareManager = $shareManager;
51
+        $this->groupManager = $groupManager;
52
+    }
53 53
 
54
-	public function handle(Event $event): void {
55
-		if (!($event instanceof ShareCreatedEvent)) {
56
-			return;
57
-		}
54
+    public function handle(Event $event): void {
55
+        if (!($event instanceof ShareCreatedEvent)) {
56
+            return;
57
+        }
58 58
 
59
-		$share = $event->getShare();
59
+        $share = $event->getShare();
60 60
 
61
-		if ($share->getShareType() === IShare::TYPE_USER) {
62
-			$this->handleAutoAccept($share, $share->getSharedWith());
63
-		} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
64
-			$group = $this->groupManager->get($share->getSharedWith());
61
+        if ($share->getShareType() === IShare::TYPE_USER) {
62
+            $this->handleAutoAccept($share, $share->getSharedWith());
63
+        } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
64
+            $group = $this->groupManager->get($share->getSharedWith());
65 65
 
66
-			if ($group === null) {
67
-				return;
68
-			}
66
+            if ($group === null) {
67
+                return;
68
+            }
69 69
 
70
-			$users = $group->getUsers();
71
-			foreach ($users as $user) {
72
-				$this->handleAutoAccept($share, $user->getUID());
73
-			}
74
-		}
75
-	}
70
+            $users = $group->getUsers();
71
+            foreach ($users as $user) {
72
+                $this->handleAutoAccept($share, $user->getUID());
73
+            }
74
+        }
75
+    }
76 76
 
77
-	private function handleAutoAccept(IShare $share, string $userId) {
78
-		$defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
79
-		$acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
80
-		if (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault) {
81
-			$this->shareManager->acceptShare($share, $userId);
82
-		}
83
-	}
77
+    private function handleAutoAccept(IShare $share, string $userId) {
78
+        $defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
79
+        $acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
80
+        if (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault) {
81
+            $this->shareManager->acceptShare($share, $userId);
82
+        }
83
+    }
84 84
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@
 block discarded – undo
32 32
  * OAuth1 authentication
33 33
  */
34 34
 class OAuth1 extends AuthMechanism {
35
-	public function __construct(IL10N $l) {
36
-		$this
37
-			->setIdentifier('oauth1::oauth1')
38
-			->setScheme(self::SCHEME_OAUTH1)
39
-			->setText($l->t('OAuth1'))
40
-			->addParameters([
41
-				(new DefinitionParameter('configured', 'configured'))
42
-					->setType(DefinitionParameter::VALUE_HIDDEN),
43
-				new DefinitionParameter('app_key', $l->t('App key')),
44
-				(new DefinitionParameter('app_secret', $l->t('App secret')))
45
-					->setType(DefinitionParameter::VALUE_PASSWORD),
46
-				(new DefinitionParameter('token', 'token'))
47
-					->setType(DefinitionParameter::VALUE_HIDDEN),
48
-				(new DefinitionParameter('token_secret', 'token_secret'))
49
-					->setType(DefinitionParameter::VALUE_HIDDEN),
50
-			])
51
-			->addCustomJs('oauth1')
52
-		;
53
-	}
35
+    public function __construct(IL10N $l) {
36
+        $this
37
+            ->setIdentifier('oauth1::oauth1')
38
+            ->setScheme(self::SCHEME_OAUTH1)
39
+            ->setText($l->t('OAuth1'))
40
+            ->addParameters([
41
+                (new DefinitionParameter('configured', 'configured'))
42
+                    ->setType(DefinitionParameter::VALUE_HIDDEN),
43
+                new DefinitionParameter('app_key', $l->t('App key')),
44
+                (new DefinitionParameter('app_secret', $l->t('App secret')))
45
+                    ->setType(DefinitionParameter::VALUE_PASSWORD),
46
+                (new DefinitionParameter('token', 'token'))
47
+                    ->setType(DefinitionParameter::VALUE_HIDDEN),
48
+                (new DefinitionParameter('token_secret', 'token_secret'))
49
+                    ->setType(DefinitionParameter::VALUE_HIDDEN),
50
+            ])
51
+            ->addCustomJs('oauth1')
52
+        ;
53
+    }
54 54
 }
Please login to merge, or discard this patch.