Completed
Pull Request — master (#6995)
by Julius
12:10
created
apps/dav/lib/CalDAV/ICalendarHomePlugin.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@
 block discarded – undo
29 29
  */
30 30
 interface ICalendarHomePlugin {
31 31
 
32
-	/**
33
-	 * Returns the path to a principal's calendar home.
34
-	 *
35
-	 * The return url must not end with a slash.
36
-	 * This function should return null in case a principal did not have
37
-	 * a calendar home.
38
-	 *
39
-	 * @param string $principalUrl
40
-	 * @return string|null
41
-	 */
42
-	public function getCalendarHomeForPrincipal($principalUrl);
32
+    /**
33
+     * Returns the path to a principal's calendar home.
34
+     *
35
+     * The return url must not end with a slash.
36
+     * This function should return null in case a principal did not have
37
+     * a calendar home.
38
+     *
39
+     * @param string $principalUrl
40
+     * @return string|null
41
+     */
42
+    public function getCalendarHomeForPrincipal($principalUrl);
43 43
 
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Plugin.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -29,63 +29,63 @@
 block discarded – undo
29 29
 
30 30
 class Plugin extends \Sabre\CalDAV\Plugin implements ICalendarHomePlugin {
31 31
 
32
-	/**
33
-	 * Initializes the plugin
34
-	 *
35
-	 * @param Server $server
36
-	 * @return void
37
-	 */
38
-	public function initialize(Server $server) {
39
-		parent::initialize($server);
40
-		$server->on('propFind', [$this, 'propFind']);
41
-	}
32
+    /**
33
+     * Initializes the plugin
34
+     *
35
+     * @param Server $server
36
+     * @return void
37
+     */
38
+    public function initialize(Server $server) {
39
+        parent::initialize($server);
40
+        $server->on('propFind', [$this, 'propFind']);
41
+    }
42 42
 
43
-	/**
44
-	 * PropFind
45
-	 *
46
-	 * This method handler is invoked before any after properties for a
47
-	 * resource are fetched. This allows us to add in any CalDAV specific
48
-	 * properties.
49
-	 *
50
-	 * @param DAV\PropFind $propFind
51
-	 * @param DAV\INode $node
52
-	 * @return void
53
-	 */
54
-	public function propFind(DAV\PropFind $propFind, DAV\INode $node) {
55
-		parent::propFind($propFind, $node);
56
-		if ($node instanceof IPrincipal) {
57
-			$principalUrl = $node->getPrincipalUrl();
58
-			$propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function () use ($principalUrl) {
59
-				$calendarHomes = [];
60
-				// Make sure the dav apps caldav endpoint is at the first place
61
-				$calendarHomePath = $this->getCalendarHomeForPrincipal($principalUrl);
62
-				if ($calendarHomePath !== null) {
63
-					$calendarHomes[] = $calendarHomePath;
64
-				}
65
-				foreach ($this->server->getPlugins() as $plugin) {
66
-					if ($plugin instanceof ICalendarHomePlugin && $plugin !== $this) {
67
-						$calendarHomePath = $plugin->getCalendarHomeForPrincipal($principalUrl);
68
-						if ($calendarHomePath !== null) {
69
-							$calendarHomes[] = $calendarHomePath;
70
-						}
71
-					}
72
-				}
73
-				return new LocalHref($calendarHomes);
74
-			});
75
-		}
76
-	}
43
+    /**
44
+     * PropFind
45
+     *
46
+     * This method handler is invoked before any after properties for a
47
+     * resource are fetched. This allows us to add in any CalDAV specific
48
+     * properties.
49
+     *
50
+     * @param DAV\PropFind $propFind
51
+     * @param DAV\INode $node
52
+     * @return void
53
+     */
54
+    public function propFind(DAV\PropFind $propFind, DAV\INode $node) {
55
+        parent::propFind($propFind, $node);
56
+        if ($node instanceof IPrincipal) {
57
+            $principalUrl = $node->getPrincipalUrl();
58
+            $propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function () use ($principalUrl) {
59
+                $calendarHomes = [];
60
+                // Make sure the dav apps caldav endpoint is at the first place
61
+                $calendarHomePath = $this->getCalendarHomeForPrincipal($principalUrl);
62
+                if ($calendarHomePath !== null) {
63
+                    $calendarHomes[] = $calendarHomePath;
64
+                }
65
+                foreach ($this->server->getPlugins() as $plugin) {
66
+                    if ($plugin instanceof ICalendarHomePlugin && $plugin !== $this) {
67
+                        $calendarHomePath = $plugin->getCalendarHomeForPrincipal($principalUrl);
68
+                        if ($calendarHomePath !== null) {
69
+                            $calendarHomes[] = $calendarHomePath;
70
+                        }
71
+                    }
72
+                }
73
+                return new LocalHref($calendarHomes);
74
+            });
75
+        }
76
+    }
77 77
 
78
-	/**
79
-	 * Add the Nextcloud default calendar home
80
-	 *
81
-	 * @inheritdoc
82
-	 */
83
-	public function getCalendarHomeForPrincipal($principalUrl) {
84
-		if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
85
-			list(, $principalId) = \Sabre\Uri\split($principalUrl);
86
-			return self::CALENDAR_ROOT .'/' . $principalId;
87
-		}
88
-		return null;
89
-	}
78
+    /**
79
+     * Add the Nextcloud default calendar home
80
+     *
81
+     * @inheritdoc
82
+     */
83
+    public function getCalendarHomeForPrincipal($principalUrl) {
84
+        if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
85
+            list(, $principalId) = \Sabre\Uri\split($principalUrl);
86
+            return self::CALENDAR_ROOT .'/' . $principalId;
87
+        }
88
+        return null;
89
+    }
90 90
 
91 91
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		parent::propFind($propFind, $node);
56 56
 		if ($node instanceof IPrincipal) {
57 57
 			$principalUrl = $node->getPrincipalUrl();
58
-			$propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function () use ($principalUrl) {
58
+			$propFind->handle('{'.self::NS_CALDAV.'}calendar-home-set', function() use ($principalUrl) {
59 59
 				$calendarHomes = [];
60 60
 				// Make sure the dav apps caldav endpoint is at the first place
61 61
 				$calendarHomePath = $this->getCalendarHomeForPrincipal($principalUrl);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function getCalendarHomeForPrincipal($principalUrl) {
84 84
 		if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
85 85
 			list(, $principalId) = \Sabre\Uri\split($principalUrl);
86
-			return self::CALENDAR_ROOT .'/' . $principalId;
86
+			return self::CALENDAR_ROOT.'/'.$principalId;
87 87
 		}
88 88
 		return null;
89 89
 	}
Please login to merge, or discard this patch.