Completed
Pull Request — master (#4098)
by Georg
24:21
created
apps/dav/lib/Migration/BuildCalendarSearchIndex.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -30,57 +30,57 @@
 block discarded – undo
30 30
 
31 31
 class BuildCalendarSearchIndex implements IRepairStep {
32 32
 
33
-	/** @var IDBConnection */
34
-	private $db;
33
+    /** @var IDBConnection */
34
+    private $db;
35 35
 
36
-	/** @var IJobList */
37
-	private $jobList;
36
+    /** @var IJobList */
37
+    private $jobList;
38 38
 
39
-	/** @var IConfig */
40
-	private $config;
39
+    /** @var IConfig */
40
+    private $config;
41 41
 
42
-	/**
43
-	 * @param IDBConnection $db
44
-	 * @param IJobList $jobList
45
-	 * @param IConfig $config
46
-	 */
47
-	public function __construct(IDBConnection $db,
48
-								IJobList $jobList,
49
-								IConfig $config) {
50
-		$this->db = $db;
51
-		$this->jobList = $jobList;
52
-		$this->config = $config;
53
-	}
42
+    /**
43
+     * @param IDBConnection $db
44
+     * @param IJobList $jobList
45
+     * @param IConfig $config
46
+     */
47
+    public function __construct(IDBConnection $db,
48
+                                IJobList $jobList,
49
+                                IConfig $config) {
50
+        $this->db = $db;
51
+        $this->jobList = $jobList;
52
+        $this->config = $config;
53
+    }
54 54
 
55
-	/**
56
-	 * @return string
57
-	 */
58
-	public function getName() {
59
-		return 'Registering building of calendar search index as background job';
60
-	}
55
+    /**
56
+     * @return string
57
+     */
58
+    public function getName() {
59
+        return 'Registering building of calendar search index as background job';
60
+    }
61 61
 
62
-	/**
63
-	 * @param IOutput $output
64
-	 */
65
-	public function run(IOutput $output) {
66
-		// only run once
67
-		if ($this->config->getAppValue('dav', 'buildCalendarSearchIndex') === 'yes') {
68
-			$output->info('Repair step already executed');
69
-			return;
70
-		}
62
+    /**
63
+     * @param IOutput $output
64
+     */
65
+    public function run(IOutput $output) {
66
+        // only run once
67
+        if ($this->config->getAppValue('dav', 'buildCalendarSearchIndex') === 'yes') {
68
+            $output->info('Repair step already executed');
69
+            return;
70
+        }
71 71
 
72
-		$query = $this->db->getQueryBuilder();
73
-		$query->select($query->createFunction('MAX(id)'))
74
-			->from('calendarobjects');
75
-		$maxId = (int)$query->execute()->fetchColumn();
72
+        $query = $this->db->getQueryBuilder();
73
+        $query->select($query->createFunction('MAX(id)'))
74
+            ->from('calendarobjects');
75
+        $maxId = (int)$query->execute()->fetchColumn();
76 76
 
77
-		$output->info('Add background job');
78
-		$this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [
79
-			'offset' => 0,
80
-			'stopAt' => $maxId
81
-		]);
77
+        $output->info('Add background job');
78
+        $this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [
79
+            'offset' => 0,
80
+            'stopAt' => $maxId
81
+        ]);
82 82
 
83
-		// if all were done, no need to redo the repair during next upgrade
84
-		$this->config->setAppValue('dav', 'buildCalendarSearchIndex', 'yes');
85
-	}
83
+        // if all were done, no need to redo the repair during next upgrade
84
+        $this->config->setAppValue('dav', 'buildCalendarSearchIndex', 'yes');
85
+    }
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/SearchPlugin.php 1 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
-	public 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(2);
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
+    public 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(2);
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.
apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -35,129 +35,129 @@
 block discarded – undo
35 35
  */
36 36
 class CalendarSearchReport implements XmlDeserializable {
37 37
 
38
-	/**
39
-	 * An array with requested properties.
40
-	 *
41
-	 * @var array
42
-	 */
43
-	public $properties;
44
-
45
-	/**
46
-	 * List of property/component filters.
47
-	 *
48
-	 * @var array
49
-	 */
50
-	public $filters;
51
-
52
-	/**
53
-	 * @var int
54
-	 */
55
-	public $limit;
56
-
57
-	/**
58
-	 * @var int
59
-	 */
60
-	public $offset;
61
-
62
-	/**
63
-	 * The deserialize method is called during xml parsing.
64
-	 *
65
-	 * This method is called statically, this is because in theory this method
66
-	 * may be used as a type of constructor, or factory method.
67
-	 *
68
-	 * Often you want to return an instance of the current class, but you are
69
-	 * free to return other data as well.
70
-	 *
71
-	 * You are responsible for advancing the reader to the next element. Not
72
-	 * doing anything will result in a never-ending loop.
73
-	 *
74
-	 * If you just want to skip parsing for this element altogether, you can
75
-	 * just call $reader->next();
76
-	 *
77
-	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
78
-	 * the next element.
79
-	 *
80
-	 * @param Reader $reader
81
-	 * @return mixed
82
-	 */
83
-	static function xmlDeserialize(Reader $reader) {
84
-		$elems = $reader->parseInnerTree([
85
-			'{http://nextcloud.com/ns}comp-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
86
-			'{http://nextcloud.com/ns}prop-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
87
-			'{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter',
88
-			'{http://nextcloud.com/ns}search-term'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
89
-			'{http://nextcloud.com/ns}limit'        => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
90
-			'{http://nextcloud.com/ns}offset'       => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
91
-			'{DAV:}prop'                            => 'Sabre\\Xml\\Element\\KeyValue',
92
-		]);
93
-
94
-		$newProps = [
95
-			'filters'    => [],
96
-			'properties' => [],
97
-			'limit'      => null,
98
-			'offset'     => null
99
-		];
100
-
101
-		if (!is_array($elems)) {
102
-			$elems = [];
103
-		}
104
-
105
-		foreach ($elems as $elem) {
106
-			switch ($elem['name']) {
107
-				case '{DAV:}prop':
108
-					$newProps['properties'] = array_keys($elem['value']);
109
-					break;
110
-				case '{' . SearchPlugin::NS_Nextcloud . '}filter':
111
-					foreach ($elem['value'] as $subElem) {
112
-						if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
113
-							if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) {
114
-								$newProps['filters']['comps'] = [];
115
-							}
116
-							$newProps['filters']['comps'][] = $subElem['value'];
117
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
118
-							if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) {
119
-								$newProps['filters']['props'] = [];
120
-							}
121
-							$newProps['filters']['props'][] = $subElem['value'];
122
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
123
-							if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) {
124
-								$newProps['filters']['params'] = [];
125
-							}
126
-							$newProps['filters']['params'][] = $subElem['value'];
127
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
128
-							$newProps['filters']['search-term'] = $subElem['value'];
129
-						}
130
-					}
131
-					break;
132
-				case '{' . SearchPlugin::NS_Nextcloud . '}limit':
133
-					$newProps['limit'] = $elem['value'];
134
-					break;
135
-				case '{' . SearchPlugin::NS_Nextcloud . '}offset':
136
-					$newProps['offset'] = $elem['value'];
137
-					break;
138
-
139
-			}
140
-		}
141
-
142
-		if (empty($newProps['filters'])) {
143
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
144
-		}
145
-
146
-		$propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']));
147
-		$noCompsDefined = empty($newProps['filters']['comps']);
148
-		if ($propsOrParamsDefined && $noCompsDefined) {
149
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
150
-		}
151
-
152
-		if (!isset($newProps['filters']['search-term'])) {
153
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request');
154
-		}
155
-
156
-
157
-		$obj = new self();
158
-		foreach ($newProps as $key => $value) {
159
-			$obj->$key = $value;
160
-		}
161
-		return $obj;
162
-	}
38
+    /**
39
+     * An array with requested properties.
40
+     *
41
+     * @var array
42
+     */
43
+    public $properties;
44
+
45
+    /**
46
+     * List of property/component filters.
47
+     *
48
+     * @var array
49
+     */
50
+    public $filters;
51
+
52
+    /**
53
+     * @var int
54
+     */
55
+    public $limit;
56
+
57
+    /**
58
+     * @var int
59
+     */
60
+    public $offset;
61
+
62
+    /**
63
+     * The deserialize method is called during xml parsing.
64
+     *
65
+     * This method is called statically, this is because in theory this method
66
+     * may be used as a type of constructor, or factory method.
67
+     *
68
+     * Often you want to return an instance of the current class, but you are
69
+     * free to return other data as well.
70
+     *
71
+     * You are responsible for advancing the reader to the next element. Not
72
+     * doing anything will result in a never-ending loop.
73
+     *
74
+     * If you just want to skip parsing for this element altogether, you can
75
+     * just call $reader->next();
76
+     *
77
+     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
78
+     * the next element.
79
+     *
80
+     * @param Reader $reader
81
+     * @return mixed
82
+     */
83
+    static function xmlDeserialize(Reader $reader) {
84
+        $elems = $reader->parseInnerTree([
85
+            '{http://nextcloud.com/ns}comp-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
86
+            '{http://nextcloud.com/ns}prop-filter'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
87
+            '{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter',
88
+            '{http://nextcloud.com/ns}search-term'  => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
89
+            '{http://nextcloud.com/ns}limit'        => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
90
+            '{http://nextcloud.com/ns}offset'       => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
91
+            '{DAV:}prop'                            => 'Sabre\\Xml\\Element\\KeyValue',
92
+        ]);
93
+
94
+        $newProps = [
95
+            'filters'    => [],
96
+            'properties' => [],
97
+            'limit'      => null,
98
+            'offset'     => null
99
+        ];
100
+
101
+        if (!is_array($elems)) {
102
+            $elems = [];
103
+        }
104
+
105
+        foreach ($elems as $elem) {
106
+            switch ($elem['name']) {
107
+                case '{DAV:}prop':
108
+                    $newProps['properties'] = array_keys($elem['value']);
109
+                    break;
110
+                case '{' . SearchPlugin::NS_Nextcloud . '}filter':
111
+                    foreach ($elem['value'] as $subElem) {
112
+                        if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
113
+                            if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) {
114
+                                $newProps['filters']['comps'] = [];
115
+                            }
116
+                            $newProps['filters']['comps'][] = $subElem['value'];
117
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
118
+                            if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) {
119
+                                $newProps['filters']['props'] = [];
120
+                            }
121
+                            $newProps['filters']['props'][] = $subElem['value'];
122
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
123
+                            if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) {
124
+                                $newProps['filters']['params'] = [];
125
+                            }
126
+                            $newProps['filters']['params'][] = $subElem['value'];
127
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
128
+                            $newProps['filters']['search-term'] = $subElem['value'];
129
+                        }
130
+                    }
131
+                    break;
132
+                case '{' . SearchPlugin::NS_Nextcloud . '}limit':
133
+                    $newProps['limit'] = $elem['value'];
134
+                    break;
135
+                case '{' . SearchPlugin::NS_Nextcloud . '}offset':
136
+                    $newProps['offset'] = $elem['value'];
137
+                    break;
138
+
139
+            }
140
+        }
141
+
142
+        if (empty($newProps['filters'])) {
143
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
144
+        }
145
+
146
+        $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']));
147
+        $noCompsDefined = empty($newProps['filters']['comps']);
148
+        if ($propsOrParamsDefined && $noCompsDefined) {
149
+            throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
150
+        }
151
+
152
+        if (!isset($newProps['filters']['search-term'])) {
153
+            throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request');
154
+        }
155
+
156
+
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.