Completed
Pull Request — master (#4098)
by Georg
13:47
created
apps/dav/lib/CalDAV/Search/SearchPlugin.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 	 * @param string $reportName
85 85
 	 * @param mixed $report
86 86
 	 * @param mixed $path
87
-	 * @return bool
87
+	 * @return false|null
88 88
 	 */
89 89
 	function report($reportName, $report, $path) {
90 90
 		switch ($reportName) {
Please login to merge, or discard this patch.
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -25,135 +25,135 @@
 block discarded – undo
25 25
 use OCA\DAV\CalDAV\CalendarHome;
26 26
 
27 27
 class SearchPlugin extends ServerPlugin {
28
-	const NS_Nextcloud = 'http://nextcloud.com/ns';
29
-
30
-	/**
31
-	 * Reference to SabreDAV server object.
32
-	 *
33
-	 * @var \Sabre\DAV\Server
34
-	 */
35
-	protected $server;
36
-
37
-	/**
38
-	 * This method should return a list of server-features.
39
-	 *
40
-	 * This is for example 'versioning' and is added to the DAV: header
41
-	 * in an OPTIONS response.
42
-	 *
43
-	 * @return string[]
44
-	 */
45
-	public function getFeatures() {
46
-		// May have to be changed to be detected
47
-		return ['nc-calendar-search'];
48
-	}
49
-
50
-	/**
51
-	 * Returns a plugin name.
52
-	 *
53
-	 * Using this name other plugins will be able to access other plugins
54
-	 * using Sabre\DAV\Server::getPlugin
55
-	 *
56
-	 * @return string
57
-	 */
58
-	public function getPluginName() {
59
-		return 'nc-calendar-search';
60
-	}
61
-
62
-	/**
63
-	 * This initializes the plugin.
64
-	 *
65
-	 * This function is called by Sabre\DAV\Server, after
66
-	 * addPlugin is called.
67
-	 *
68
-	 * This method should set up the required event subscriptions.
69
-	 *
70
-	 * @param Server $server
71
-	 */
72
-	public function initialize(Server $server) {
73
-		$this->server = $server;
74
-
75
-		$server->on('report', [$this, 'report']);
76
-
77
-		$server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] =
78
-			'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport';
79
-	}
80
-
81
-	/**
82
-	 * This functions handles REPORT requests specific to CalDAV
83
-	 *
84
-	 * @param string $reportName
85
-	 * @param mixed $report
86
-	 * @param mixed $path
87
-	 * @return bool
88
-	 */
89
-	function report($reportName, $report, $path) {
90
-		switch ($reportName) {
91
-			case '{' . self::NS_Nextcloud . '}calendar-search' :
92
-				$this->server->transactionType = 'report-nc-calendar-search';
93
-				$this->calendarSearch($report);
94
-				return false;
95
-		}
96
-	}
97
-
98
-	/**
99
-	 * Returns a list of reports this plugin supports.
100
-	 *
101
-	 * This will be used in the {DAV:}supported-report-set property.
102
-	 * Note that you still need to subscribe to the 'report' event to actually
103
-	 * implement them
104
-	 *
105
-	 * @param string $uri
106
-	 * @return array
107
-	 */
108
-	public function getSupportedReportSet($uri) {
109
-		$node = $this->server->tree->getNodeForPath($uri);
110
-
111
-		$reports = [];
112
-		if ($node instanceof CalendarHome) {
113
-			$reports[] = '{' . self::NS_Nextcloud . '}calendar-search';
114
-		}
115
-
116
-		return $reports;
117
-	}
118
-
119
-	/**
120
-	 * This function handles the calendar-query REPORT
121
-	 *
122
-	 * This report is used by clients to request calendar objects based on
123
-	 * complex conditions.
124
-	 *
125
-	 * @param Xml\Request\CalendarSearchReport $report
126
-	 * @return void
127
-	 */
128
-	private function calendarSearch($report) {
129
-		$node = $this->server->tree->getNodeForPath($this->server->getRequestUri());
130
-		$depth = $this->server->getHTTPDepth(0);
131
-
132
-		// The default result is an empty array
133
-		$result = [];
134
-
135
-		// If we're dealing with the calendar home, the calendar home itself is
136
-		// responsible for the calendar-query
137
-		if ($node instanceof CalendarHome && $depth == 2) {
138
-
139
-			$nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset);
140
-
141
-			foreach ($nodePaths as $path) {
142
-				list($properties) = $this->server->getPropertiesForPath(
143
-					$this->server->getRequestUri() . '/' . $path,
144
-					$report->properties);
145
-				$result[] = $properties;
146
-			}
147
-		}
148
-
149
-		$prefer = $this->server->getHTTPPrefer();
150
-
151
-		$this->server->httpResponse->setStatus(207);
152
-		$this->server->httpResponse->setHeader('Content-Type',
153
-			'application/xml; charset=utf-8');
154
-		$this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
155
-		$this->server->httpResponse->setBody(
156
-			$this->server->generateMultiStatus($result,
157
-				$prefer['return'] === 'minimal'));
158
-	}
28
+    const NS_Nextcloud = 'http://nextcloud.com/ns';
29
+
30
+    /**
31
+     * Reference to SabreDAV server object.
32
+     *
33
+     * @var \Sabre\DAV\Server
34
+     */
35
+    protected $server;
36
+
37
+    /**
38
+     * This method should return a list of server-features.
39
+     *
40
+     * This is for example 'versioning' and is added to the DAV: header
41
+     * in an OPTIONS response.
42
+     *
43
+     * @return string[]
44
+     */
45
+    public function getFeatures() {
46
+        // May have to be changed to be detected
47
+        return ['nc-calendar-search'];
48
+    }
49
+
50
+    /**
51
+     * Returns a plugin name.
52
+     *
53
+     * Using this name other plugins will be able to access other plugins
54
+     * using Sabre\DAV\Server::getPlugin
55
+     *
56
+     * @return string
57
+     */
58
+    public function getPluginName() {
59
+        return 'nc-calendar-search';
60
+    }
61
+
62
+    /**
63
+     * This initializes the plugin.
64
+     *
65
+     * This function is called by Sabre\DAV\Server, after
66
+     * addPlugin is called.
67
+     *
68
+     * This method should set up the required event subscriptions.
69
+     *
70
+     * @param Server $server
71
+     */
72
+    public function initialize(Server $server) {
73
+        $this->server = $server;
74
+
75
+        $server->on('report', [$this, 'report']);
76
+
77
+        $server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] =
78
+            'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport';
79
+    }
80
+
81
+    /**
82
+     * This functions handles REPORT requests specific to CalDAV
83
+     *
84
+     * @param string $reportName
85
+     * @param mixed $report
86
+     * @param mixed $path
87
+     * @return bool
88
+     */
89
+    function report($reportName, $report, $path) {
90
+        switch ($reportName) {
91
+            case '{' . self::NS_Nextcloud . '}calendar-search' :
92
+                $this->server->transactionType = 'report-nc-calendar-search';
93
+                $this->calendarSearch($report);
94
+                return false;
95
+        }
96
+    }
97
+
98
+    /**
99
+     * Returns a list of reports this plugin supports.
100
+     *
101
+     * This will be used in the {DAV:}supported-report-set property.
102
+     * Note that you still need to subscribe to the 'report' event to actually
103
+     * implement them
104
+     *
105
+     * @param string $uri
106
+     * @return array
107
+     */
108
+    public function getSupportedReportSet($uri) {
109
+        $node = $this->server->tree->getNodeForPath($uri);
110
+
111
+        $reports = [];
112
+        if ($node instanceof CalendarHome) {
113
+            $reports[] = '{' . self::NS_Nextcloud . '}calendar-search';
114
+        }
115
+
116
+        return $reports;
117
+    }
118
+
119
+    /**
120
+     * This function handles the calendar-query REPORT
121
+     *
122
+     * This report is used by clients to request calendar objects based on
123
+     * complex conditions.
124
+     *
125
+     * @param Xml\Request\CalendarSearchReport $report
126
+     * @return void
127
+     */
128
+    private function calendarSearch($report) {
129
+        $node = $this->server->tree->getNodeForPath($this->server->getRequestUri());
130
+        $depth = $this->server->getHTTPDepth(0);
131
+
132
+        // The default result is an empty array
133
+        $result = [];
134
+
135
+        // If we're dealing with the calendar home, the calendar home itself is
136
+        // responsible for the calendar-query
137
+        if ($node instanceof CalendarHome && $depth == 2) {
138
+
139
+            $nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset);
140
+
141
+            foreach ($nodePaths as $path) {
142
+                list($properties) = $this->server->getPropertiesForPath(
143
+                    $this->server->getRequestUri() . '/' . $path,
144
+                    $report->properties);
145
+                $result[] = $properties;
146
+            }
147
+        }
148
+
149
+        $prefer = $this->server->getHTTPPrefer();
150
+
151
+        $this->server->httpResponse->setStatus(207);
152
+        $this->server->httpResponse->setHeader('Content-Type',
153
+            'application/xml; charset=utf-8');
154
+        $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
155
+        $this->server->httpResponse->setBody(
156
+            $this->server->generateMultiStatus($result,
157
+                $prefer['return'] === 'minimal'));
158
+    }
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$server->on('report', [$this, 'report']);
76 76
 
77
-		$server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] =
77
+		$server->xml->elementMap['{'.self::NS_Nextcloud.'}calendar-search'] =
78 78
 			'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport';
79 79
 	}
80 80
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	function report($reportName, $report, $path) {
90 90
 		switch ($reportName) {
91
-			case '{' . self::NS_Nextcloud . '}calendar-search' :
91
+			case '{'.self::NS_Nextcloud.'}calendar-search' :
92 92
 				$this->server->transactionType = 'report-nc-calendar-search';
93 93
 				$this->calendarSearch($report);
94 94
 				return false;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 		$reports = [];
112 112
 		if ($node instanceof CalendarHome) {
113
-			$reports[] = '{' . self::NS_Nextcloud . '}calendar-search';
113
+			$reports[] = '{'.self::NS_Nextcloud.'}calendar-search';
114 114
 		}
115 115
 
116 116
 		return $reports;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 			foreach ($nodePaths as $path) {
142 142
 				list($properties) = $this->server->getPropertiesForPath(
143
-					$this->server->getRequestUri() . '/' . $path,
143
+					$this->server->getRequestUri().'/'.$path,
144 144
 					$report->properties);
145 145
 				$result[] = $properties;
146 146
 			}
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 	 * the next element.
80 80
 	 *
81 81
 	 * @param Reader $reader
82
-	 * @return mixed
82
+	 * @return CalendarSearchReport
83 83
 	 */
84 84
 	static function xmlDeserialize(Reader $reader) {
85 85
 		$elems = $reader->parseInnerTree([
Please login to merge, or discard this patch.
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -36,128 +36,128 @@
 block discarded – undo
36 36
  */
37 37
 class CalendarSearchReport implements XmlDeserializable {
38 38
 
39
-	/**
40
-	 * An array with requested properties.
41
-	 *
42
-	 * @var array
43
-	 */
44
-	public $properties;
39
+    /**
40
+     * An array with requested properties.
41
+     *
42
+     * @var array
43
+     */
44
+    public $properties;
45 45
 
46
-	/**
47
-	 * List of property/component filters.
48
-	 *
49
-	 * @var array
50
-	 */
51
-	public $filters;
46
+    /**
47
+     * List of property/component filters.
48
+     *
49
+     * @var array
50
+     */
51
+    public $filters;
52 52
 
53
-	/**
54
-	 * @var int
55
-	 */
56
-	public $limit;
53
+    /**
54
+     * @var int
55
+     */
56
+    public $limit;
57 57
 
58
-	/**
59
-	 * @var int
60
-	 */
61
-	public $offset;
58
+    /**
59
+     * @var int
60
+     */
61
+    public $offset;
62 62
 
63
-	/**
64
-	 * The deserialize method is called during xml parsing.
65
-	 *
66
-	 * This method is called statically, this is because in theory this method
67
-	 * may be used as a type of constructor, or factory method.
68
-	 *
69
-	 * Often you want to return an instance of the current class, but you are
70
-	 * free to return other data as well.
71
-	 *
72
-	 * You are responsible for advancing the reader to the next element. Not
73
-	 * doing anything will result in a never-ending loop.
74
-	 *
75
-	 * If you just want to skip parsing for this element altogether, you can
76
-	 * just call $reader->next();
77
-	 *
78
-	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
79
-	 * the next element.
80
-	 *
81
-	 * @param Reader $reader
82
-	 * @return mixed
83
-	 */
84
-	static function xmlDeserialize(Reader $reader) {
85
-		$elems = $reader->parseInnerTree([
86
-			'{http://nextcloud.com/ns}comp-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
87
-			'{http://nextcloud.com/ns}prop-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
88
-			'{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter',
89
-			'{http://nextcloud.com/ns}search-term'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
90
-			'{http://nextcloud.com/ns}limit'        => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
91
-			'{http://nextcloud.com/ns}offset'       => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
92
-			'{DAV:}prop'                            => 'Sabre\\Xml\\Element\\KeyValue',
93
-		]);
63
+    /**
64
+     * The deserialize method is called during xml parsing.
65
+     *
66
+     * This method is called statically, this is because in theory this method
67
+     * may be used as a type of constructor, or factory method.
68
+     *
69
+     * Often you want to return an instance of the current class, but you are
70
+     * free to return other data as well.
71
+     *
72
+     * You are responsible for advancing the reader to the next element. Not
73
+     * doing anything will result in a never-ending loop.
74
+     *
75
+     * If you just want to skip parsing for this element altogether, you can
76
+     * just call $reader->next();
77
+     *
78
+     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
79
+     * the next element.
80
+     *
81
+     * @param Reader $reader
82
+     * @return mixed
83
+     */
84
+    static function xmlDeserialize(Reader $reader) {
85
+        $elems = $reader->parseInnerTree([
86
+            '{http://nextcloud.com/ns}comp-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
87
+            '{http://nextcloud.com/ns}prop-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
88
+            '{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter',
89
+            '{http://nextcloud.com/ns}search-term'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
90
+            '{http://nextcloud.com/ns}limit'        => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
91
+            '{http://nextcloud.com/ns}offset'       => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
92
+            '{DAV:}prop'                            => 'Sabre\\Xml\\Element\\KeyValue',
93
+        ]);
94 94
 
95
-		$newProps = [
96
-			'filters'    => [],
97
-			'properties' => [],
98
-			'limit'      => null,
99
-			'offset'     => null
100
-		];
95
+        $newProps = [
96
+            'filters'    => [],
97
+            'properties' => [],
98
+            'limit'      => null,
99
+            'offset'     => null
100
+        ];
101 101
 
102
-		if (!is_array($elems)) {
103
-			$elems = [];
104
-		}
102
+        if (!is_array($elems)) {
103
+            $elems = [];
104
+        }
105 105
 
106
-		foreach ($elems as $elem) {
107
-			switch ($elem['name']) {
108
-				case '{DAV:}prop':
109
-					$newProps['properties'] = array_keys($elem['value']);
110
-					if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
111
-						$newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
112
-					}
113
-					break;
114
-				case '{' . SearchPlugin::NS_Nextcloud . '}filter':
115
-					foreach ($elem['value'] as $subElem) {
116
-						if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
117
-							if (!is_array($newProps['filters']['comps'])) {
118
-								$newProps['filters']['comps'] = [];
119
-							}
120
-							$newProps['filters']['comps'][] = $subElem['value'];
121
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
122
-							if (!is_array($newProps['filters']['props'])) {
123
-								$newProps['filters']['props'] = [];
124
-							}
125
-							$newProps['filters']['props'][] = $subElem['value'];
126
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
127
-							if (!is_array($newProps['filters']['params'])) {
128
-								$newProps['filters']['params'] = [];
129
-							}
130
-							$newProps['filters']['params'][] = $subElem['value'];
131
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
132
-							$newProps['filters']['search-term'] = $subElem['value'];
133
-						}
134
-					}
135
-					break;
136
-				case '{' . SearchPlugin::NS_Nextcloud . '}limit':
137
-					$newProps['limit'] = $elem['value'];
138
-					break;
139
-				case '{' . SearchPlugin::NS_Nextcloud . '}offset':
140
-					$newProps['offset'] = $elem['value'];
141
-					break;
106
+        foreach ($elems as $elem) {
107
+            switch ($elem['name']) {
108
+                case '{DAV:}prop':
109
+                    $newProps['properties'] = array_keys($elem['value']);
110
+                    if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
111
+                        $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
112
+                    }
113
+                    break;
114
+                case '{' . SearchPlugin::NS_Nextcloud . '}filter':
115
+                    foreach ($elem['value'] as $subElem) {
116
+                        if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
117
+                            if (!is_array($newProps['filters']['comps'])) {
118
+                                $newProps['filters']['comps'] = [];
119
+                            }
120
+                            $newProps['filters']['comps'][] = $subElem['value'];
121
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
122
+                            if (!is_array($newProps['filters']['props'])) {
123
+                                $newProps['filters']['props'] = [];
124
+                            }
125
+                            $newProps['filters']['props'][] = $subElem['value'];
126
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
127
+                            if (!is_array($newProps['filters']['params'])) {
128
+                                $newProps['filters']['params'] = [];
129
+                            }
130
+                            $newProps['filters']['params'][] = $subElem['value'];
131
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
132
+                            $newProps['filters']['search-term'] = $subElem['value'];
133
+                        }
134
+                    }
135
+                    break;
136
+                case '{' . SearchPlugin::NS_Nextcloud . '}limit':
137
+                    $newProps['limit'] = $elem['value'];
138
+                    break;
139
+                case '{' . SearchPlugin::NS_Nextcloud . '}offset':
140
+                    $newProps['offset'] = $elem['value'];
141
+                    break;
142 142
 
143
-			}
144
-		}
143
+            }
144
+        }
145 145
 
146
-		if (empty($newProps['filters'])) {
147
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
148
-		}
146
+        if (empty($newProps['filters'])) {
147
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
148
+        }
149 149
 
150
-		$propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']));
151
-		$noCompsDefined = empty($newProps['filters']['comps']);
152
-		if ($propsOrParamsDefined && $noCompsDefined) {
153
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
154
-		}
150
+        $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']));
151
+        $noCompsDefined = empty($newProps['filters']['comps']);
152
+        if ($propsOrParamsDefined && $noCompsDefined) {
153
+            throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
154
+        }
155 155
 
156 156
 
157
-		$obj = new self();
158
-		foreach ($newProps as $key => $value) {
159
-			$obj->$key = $value;
160
-		}
161
-		return $obj;
162
-	}
157
+        $obj = new self();
158
+        foreach ($newProps as $key => $value) {
159
+            $obj->$key = $value;
160
+        }
161
+        return $obj;
162
+    }
163 163
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -107,36 +107,36 @@  discard block
 block discarded – undo
107 107
 			switch ($elem['name']) {
108 108
 				case '{DAV:}prop':
109 109
 					$newProps['properties'] = array_keys($elem['value']);
110
-					if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
111
-						$newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
110
+					if (isset($elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'])) {
111
+						$newProps += $elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'];
112 112
 					}
113 113
 					break;
114
-				case '{' . SearchPlugin::NS_Nextcloud . '}filter':
114
+				case '{'.SearchPlugin::NS_Nextcloud.'}filter':
115 115
 					foreach ($elem['value'] as $subElem) {
116
-						if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
116
+						if ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}comp-filter') {
117 117
 							if (!is_array($newProps['filters']['comps'])) {
118 118
 								$newProps['filters']['comps'] = [];
119 119
 							}
120 120
 							$newProps['filters']['comps'][] = $subElem['value'];
121
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
121
+						} elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}prop-filter') {
122 122
 							if (!is_array($newProps['filters']['props'])) {
123 123
 								$newProps['filters']['props'] = [];
124 124
 							}
125 125
 							$newProps['filters']['props'][] = $subElem['value'];
126
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
126
+						} elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}param-filter') {
127 127
 							if (!is_array($newProps['filters']['params'])) {
128 128
 								$newProps['filters']['params'] = [];
129 129
 							}
130 130
 							$newProps['filters']['params'][] = $subElem['value'];
131
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
131
+						} elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}search-term') {
132 132
 							$newProps['filters']['search-term'] = $subElem['value'];
133 133
 						}
134 134
 					}
135 135
 					break;
136
-				case '{' . SearchPlugin::NS_Nextcloud . '}limit':
136
+				case '{'.SearchPlugin::NS_Nextcloud.'}limit':
137 137
 					$newProps['limit'] = $elem['value'];
138 138
 					break;
139
-				case '{' . SearchPlugin::NS_Nextcloud . '}offset':
139
+				case '{'.SearchPlugin::NS_Nextcloud.'}offset':
140 140
 					$newProps['offset'] = $elem['value'];
141 141
 					break;
142 142
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		if (empty($newProps['filters'])) {
147
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
147
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}filter element is required for this request');
148 148
 		}
149 149
 
150 150
 		$propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']));
151 151
 		$noCompsDefined = empty($newProps['filters']['comps']);
152 152
 		if ($propsOrParamsDefined && $noCompsDefined) {
153
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
153
+			throw new BadRequest('{'.SearchPlugin::NS_Nextcloud.'}prop-filter or {'.SearchPlugin::NS_Nextcloud.'}param-filter given without any {'.SearchPlugin::NS_Nextcloud.'}comp-filter');
154 154
 		}
155 155
 
156 156
 
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/CalendarSearchValidator.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -24,79 +24,79 @@
 block discarded – undo
24 24
 
25 25
 class CalendarSearchValidator {
26 26
 
27
-	/**
28
-	 * Verify if a list of filters applies to the calendar data object
29
-	 *
30
-	 * The list of filters must be formatted as parsed by Xml\Request\CalendarSearchReport
31
-	 *
32
-	 * @param VObject\Component\VCalendar $vObject
33
-	 * @param array $filters
34
-	 * @return bool
35
-	 */
36
-	function validate(VObject\Component\VCalendar $vObject, array $filters) {
37
-		$comps = $vObject->getComponents();
38
-		$filters['comps'][] = 'VTIMEZONE';
27
+    /**
28
+     * Verify if a list of filters applies to the calendar data object
29
+     *
30
+     * The list of filters must be formatted as parsed by Xml\Request\CalendarSearchReport
31
+     *
32
+     * @param VObject\Component\VCalendar $vObject
33
+     * @param array $filters
34
+     * @return bool
35
+     */
36
+    function validate(VObject\Component\VCalendar $vObject, array $filters) {
37
+        $comps = $vObject->getComponents();
38
+        $filters['comps'][] = 'VTIMEZONE';
39 39
 
40
-		$matches = false;
41
-		foreach($comps as $comp) {
42
-			if ($comp->name === 'VTIMEZONE') {
43
-				continue;
44
-			}
45
-			if ($matches) {
46
-				break;
47
-			}
40
+        $matches = false;
41
+        foreach($comps as $comp) {
42
+            if ($comp->name === 'VTIMEZONE') {
43
+                continue;
44
+            }
45
+            if ($matches) {
46
+                break;
47
+            }
48 48
 
49
-			// check comps
50
-			if (!in_array($comp->name, $filters['comps'])) {
51
-				return false;
52
-			}
49
+            // check comps
50
+            if (!in_array($comp->name, $filters['comps'])) {
51
+                return false;
52
+            }
53 53
 
54
-			$children = $comp->children();
55
-			foreach($children as $child) {
56
-				if (!($child instanceof VObject\Property)) {
57
-					continue;
58
-				}
59
-				if ($matches) {
60
-					break;
61
-				}
54
+            $children = $comp->children();
55
+            foreach($children as $child) {
56
+                if (!($child instanceof VObject\Property)) {
57
+                    continue;
58
+                }
59
+                if ($matches) {
60
+                    break;
61
+                }
62 62
 
63
-				foreach($filters['props'] as $prop) {
64
-					if ($child->name !== $prop) {
65
-						continue;
66
-					}
63
+                foreach($filters['props'] as $prop) {
64
+                    if ($child->name !== $prop) {
65
+                        continue;
66
+                    }
67 67
 
68
-					$value = $child->getValue();
69
-					if (substr_count($value, $filters['search-term'])) {
70
-						$matches = true;
71
-						break;
72
-					}
73
-				}
68
+                    $value = $child->getValue();
69
+                    if (substr_count($value, $filters['search-term'])) {
70
+                        $matches = true;
71
+                        break;
72
+                    }
73
+                }
74 74
 
75
-				foreach($filters['params'] as $param) {
76
-					$propName = $param['property'];
77
-					$paramName = $param['parameter'];
75
+                foreach($filters['params'] as $param) {
76
+                    $propName = $param['property'];
77
+                    $paramName = $param['parameter'];
78 78
 
79
-					if ($child->name !== $propName) {
80
-						continue;
81
-					}
82
-					if ($matches) {
83
-						break;
84
-					}
79
+                    if ($child->name !== $propName) {
80
+                        continue;
81
+                    }
82
+                    if ($matches) {
83
+                        break;
84
+                    }
85 85
 
86
-					$parameters = $child->parameters();
87
-					foreach ($parameters as $key => $value) {
88
-						if ($paramName !== $key) {
89
-							continue;
90
-						}
91
-						if (substr_count($value, $filters['search-term'])) {
92
-							$matches = true;
93
-							break;
94
-						}
95
-					}
96
-				}
97
-			}
98
-		}
86
+                    $parameters = $child->parameters();
87
+                    foreach ($parameters as $key => $value) {
88
+                        if ($paramName !== $key) {
89
+                            continue;
90
+                        }
91
+                        if (substr_count($value, $filters['search-term'])) {
92
+                            $matches = true;
93
+                            break;
94
+                        }
95
+                    }
96
+                }
97
+            }
98
+        }
99 99
 
100
-		return $matches;
101
-	}
100
+        return $matches;
101
+    }
102 102
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$filters['comps'][] = 'VTIMEZONE';
39 39
 
40 40
 		$matches = false;
41
-		foreach($comps as $comp) {
41
+		foreach ($comps as $comp) {
42 42
 			if ($comp->name === 'VTIMEZONE') {
43 43
 				continue;
44 44
 			}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			}
53 53
 
54 54
 			$children = $comp->children();
55
-			foreach($children as $child) {
55
+			foreach ($children as $child) {
56 56
 				if (!($child instanceof VObject\Property)) {
57 57
 					continue;
58 58
 				}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 					break;
61 61
 				}
62 62
 
63
-				foreach($filters['props'] as $prop) {
63
+				foreach ($filters['props'] as $prop) {
64 64
 					if ($child->name !== $prop) {
65 65
 						continue;
66 66
 					}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 					}
73 73
 				}
74 74
 
75
-				foreach($filters['params'] as $param) {
75
+				foreach ($filters['params'] as $param) {
76 76
 					$propName = $param['property'];
77 77
 					$paramName = $param['parameter'];
78 78
 
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 
28 28
 class CompFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$att = $reader->parseAttributes();
37
-		$componentName = $att['name'];
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $att = $reader->parseAttributes();
37
+        $componentName = $att['name'];
38 38
 
39
-		$reader->parseInnerTree();
39
+        $reader->parseInnerTree();
40 40
 
41
-		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
43
-		}
41
+        if (!is_string($componentName)) {
42
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
43
+        }
44 44
 
45
-		return $componentName;
46
-	}
45
+        return $componentName;
46
+    }
47 47
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 		$reader->parseInnerTree();
40 40
 
41 41
 		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
42
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}comp-filter requires a valid name attribute');
43 43
 		}
44 44
 
45 45
 		return $componentName;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@
 block discarded – undo
27 27
 
28 28
 class LimitFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return int
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$value = $reader->parseInnerTree();
37
-		if (!is_int($value) && !is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
39
-		}
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return int
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $value = $reader->parseInnerTree();
37
+        if (!is_int($value) && !is_string($value)) {
38
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
39
+        }
40 40
 
41
-		return intval($value);
42
-	}
41
+        return intval($value);
42
+    }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	static function xmlDeserialize(Reader $reader) {
36 36
 		$value = $reader->parseInnerTree();
37 37
 		if (!is_int($value) && !is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
38
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}limit has illegal value');
39 39
 		}
40 40
 
41 41
 		return intval($value);
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@
 block discarded – undo
27 27
 
28 28
 class SearchTermFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$value = $reader->parseInnerTree();
37
-		if (!is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
39
-		}
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $value = $reader->parseInnerTree();
37
+        if (!is_string($value)) {
38
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
39
+        }
40 40
 
41
-		return $value;
42
-	}
41
+        return $value;
42
+    }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	static function xmlDeserialize(Reader $reader) {
36 36
 		$value = $reader->parseInnerTree();
37 37
 		if (!is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
38
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}search-term has illegal value');
39 39
 		}
40 40
 
41 41
 		return $value;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@
 block discarded – undo
27 27
 
28 28
 class OffsetFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return int
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$value = $reader->parseInnerTree();
37
-		if (!is_int($value) && !is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
39
-		}
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return int
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $value = $reader->parseInnerTree();
37
+        if (!is_int($value) && !is_string($value)) {
38
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
39
+        }
40 40
 
41
-		return intval($value);
42
-	}
41
+        return intval($value);
42
+    }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	static function xmlDeserialize(Reader $reader) {
36 36
 		$value = $reader->parseInnerTree();
37 37
 		if (!is_int($value) && !is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
38
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}offset has illegal value');
39 39
 		}
40 40
 
41 41
 		return intval($value);
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 
28 28
 class PropFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$att = $reader->parseAttributes();
37
-		$componentName = $att['name'];
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $att = $reader->parseAttributes();
37
+        $componentName = $att['name'];
38 38
 
39
-		$reader->parseInnerTree();
39
+        $reader->parseInnerTree();
40 40
 
41
-		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute');
43
-		}
41
+        if (!is_string($componentName)) {
42
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute');
43
+        }
44 44
 
45
-		return $componentName;
46
-	}
45
+        return $componentName;
46
+    }
47 47
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 		$reader->parseInnerTree();
40 40
 
41 41
 		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute');
42
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}prop-filter requires a valid name attribute');
43 43
 		}
44 44
 
45 45
 		return $componentName;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,29 +27,29 @@
 block discarded – undo
27 27
 
28 28
 class ParamFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$att = $reader->parseAttributes();
37
-		$property = $att['property'];
38
-		$parameter = $att['name'];
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $att = $reader->parseAttributes();
37
+        $property = $att['property'];
38
+        $parameter = $att['name'];
39 39
 
40
-		$reader->parseInnerTree();
40
+        $reader->parseInnerTree();
41 41
 
42
-		if (!is_string($property)) {
43
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute');
42
+        if (!is_string($property)) {
43
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute');
44 44
 
45
-		}
46
-		if (!is_string($parameter)) {
47
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute');
48
-		}
45
+        }
46
+        if (!is_string($parameter)) {
47
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute');
48
+        }
49 49
 
50
-		return [
51
-			'property' => $property,
52
-			'parameter' => $parameter,
53
-		];
54
-	}
50
+        return [
51
+            'property' => $property,
52
+            'parameter' => $parameter,
53
+        ];
54
+    }
55 55
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
 		$reader->parseInnerTree();
41 41
 
42 42
 		if (!is_string($property)) {
43
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute');
43
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}param-filter requires a valid property attribute');
44 44
 
45 45
 		}
46 46
 		if (!is_string($parameter)) {
47
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute');
47
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}param-filter requires a valid parameter attribute');
48 48
 		}
49 49
 
50 50
 		return [
Please login to merge, or discard this patch.