@@ -31,12 +31,12 @@ |
||
31 | 31 | */ |
32 | 32 | class EntityTooLarge extends \Sabre\DAV\Exception { |
33 | 33 | |
34 | - /** |
|
35 | - * Returns the HTTP status code for this exception |
|
36 | - * |
|
37 | - * @return int |
|
38 | - */ |
|
39 | - public function getHTTPCode() { |
|
40 | - return 413; |
|
41 | - } |
|
34 | + /** |
|
35 | + * Returns the HTTP status code for this exception |
|
36 | + * |
|
37 | + * @return int |
|
38 | + */ |
|
39 | + public function getHTTPCode() { |
|
40 | + return 413; |
|
41 | + } |
|
42 | 42 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return null; |
89 | 89 | } |
90 | 90 | foreach ($tree as $elem) { |
91 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') { |
|
91 | + if ($elem['name'] === '{'.self::NS_OWNCLOUD.'}tag') { |
|
92 | 92 | $tags[] = $elem['value']; |
93 | 93 | } |
94 | 94 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function xmlSerialize(Writer $writer) { |
118 | 118 | foreach ($this->tags as $tag) { |
119 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); |
|
119 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}tag', $tag); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -34,89 +34,89 @@ |
||
34 | 34 | * This property contains multiple "tag" elements, each containing a tag name. |
35 | 35 | */ |
36 | 36 | class TagList implements Element { |
37 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
37 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
38 | 38 | |
39 | - /** |
|
40 | - * tags |
|
41 | - * |
|
42 | - * @var array |
|
43 | - */ |
|
44 | - private $tags; |
|
39 | + /** |
|
40 | + * tags |
|
41 | + * |
|
42 | + * @var array |
|
43 | + */ |
|
44 | + private $tags; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param array $tags |
|
48 | - */ |
|
49 | - public function __construct(array $tags) { |
|
50 | - $this->tags = $tags; |
|
51 | - } |
|
46 | + /** |
|
47 | + * @param array $tags |
|
48 | + */ |
|
49 | + public function __construct(array $tags) { |
|
50 | + $this->tags = $tags; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Returns the tags |
|
55 | - * |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function getTags() { |
|
59 | - return $this->tags; |
|
60 | - } |
|
53 | + /** |
|
54 | + * Returns the tags |
|
55 | + * |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function getTags() { |
|
59 | + return $this->tags; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * The deserialize method is called during xml parsing. |
|
64 | - * |
|
65 | - * This method is called statictly, 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 | - public static function xmlDeserialize(Reader $reader) { |
|
84 | - $tags = []; |
|
62 | + /** |
|
63 | + * The deserialize method is called during xml parsing. |
|
64 | + * |
|
65 | + * This method is called statictly, 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 | + public static function xmlDeserialize(Reader $reader) { |
|
84 | + $tags = []; |
|
85 | 85 | |
86 | - $tree = $reader->parseInnerTree(); |
|
87 | - if ($tree === null) { |
|
88 | - return null; |
|
89 | - } |
|
90 | - foreach ($tree as $elem) { |
|
91 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') { |
|
92 | - $tags[] = $elem['value']; |
|
93 | - } |
|
94 | - } |
|
95 | - return new self($tags); |
|
96 | - } |
|
86 | + $tree = $reader->parseInnerTree(); |
|
87 | + if ($tree === null) { |
|
88 | + return null; |
|
89 | + } |
|
90 | + foreach ($tree as $elem) { |
|
91 | + if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') { |
|
92 | + $tags[] = $elem['value']; |
|
93 | + } |
|
94 | + } |
|
95 | + return new self($tags); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * The xmlSerialize metod is called during xml writing. |
|
100 | - * |
|
101 | - * Use the $writer argument to write its own xml serialization. |
|
102 | - * |
|
103 | - * An important note: do _not_ create a parent element. Any element |
|
104 | - * implementing XmlSerializble should only ever write what's considered |
|
105 | - * its 'inner xml'. |
|
106 | - * |
|
107 | - * The parent of the current element is responsible for writing a |
|
108 | - * containing element. |
|
109 | - * |
|
110 | - * This allows serializers to be re-used for different element names. |
|
111 | - * |
|
112 | - * If you are opening new elements, you must also close them again. |
|
113 | - * |
|
114 | - * @param Writer $writer |
|
115 | - * @return void |
|
116 | - */ |
|
117 | - public function xmlSerialize(Writer $writer) { |
|
118 | - foreach ($this->tags as $tag) { |
|
119 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); |
|
120 | - } |
|
121 | - } |
|
98 | + /** |
|
99 | + * The xmlSerialize metod is called during xml writing. |
|
100 | + * |
|
101 | + * Use the $writer argument to write its own xml serialization. |
|
102 | + * |
|
103 | + * An important note: do _not_ create a parent element. Any element |
|
104 | + * implementing XmlSerializble should only ever write what's considered |
|
105 | + * its 'inner xml'. |
|
106 | + * |
|
107 | + * The parent of the current element is responsible for writing a |
|
108 | + * containing element. |
|
109 | + * |
|
110 | + * This allows serializers to be re-used for different element names. |
|
111 | + * |
|
112 | + * If you are opening new elements, you must also close them again. |
|
113 | + * |
|
114 | + * @param Writer $writer |
|
115 | + * @return void |
|
116 | + */ |
|
117 | + public function xmlSerialize(Writer $writer) { |
|
118 | + foreach ($this->tags as $tag) { |
|
119 | + $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); |
|
120 | + } |
|
121 | + } |
|
122 | 122 | } |
@@ -87,10 +87,10 @@ |
||
87 | 87 | * @return void |
88 | 88 | */ |
89 | 89 | public function propFind(PropFind $propFind, INode $node) { |
90 | - $propFind->handle('{DAV:}supportedlock', function () { |
|
90 | + $propFind->handle('{DAV:}supportedlock', function() { |
|
91 | 91 | return new SupportedLock(true); |
92 | 92 | }); |
93 | - $propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) { |
|
93 | + $propFind->handle('{DAV:}lockdiscovery', function() use ($propFind) { |
|
94 | 94 | return new LockDiscovery([]); |
95 | 95 | }); |
96 | 96 | } |
@@ -47,113 +47,113 @@ |
||
47 | 47 | * @package OCA\DAV\Connector\Sabre |
48 | 48 | */ |
49 | 49 | class FakeLockerPlugin extends ServerPlugin { |
50 | - /** @var \Sabre\DAV\Server */ |
|
51 | - private $server; |
|
50 | + /** @var \Sabre\DAV\Server */ |
|
51 | + private $server; |
|
52 | 52 | |
53 | - /** {@inheritDoc} */ |
|
54 | - public function initialize(\Sabre\DAV\Server $server) { |
|
55 | - $this->server = $server; |
|
56 | - $this->server->on('method:LOCK', [$this, 'fakeLockProvider'], 1); |
|
57 | - $this->server->on('method:UNLOCK', [$this, 'fakeUnlockProvider'], 1); |
|
58 | - $server->on('propFind', [$this, 'propFind']); |
|
59 | - $server->on('validateTokens', [$this, 'validateTokens']); |
|
60 | - } |
|
53 | + /** {@inheritDoc} */ |
|
54 | + public function initialize(\Sabre\DAV\Server $server) { |
|
55 | + $this->server = $server; |
|
56 | + $this->server->on('method:LOCK', [$this, 'fakeLockProvider'], 1); |
|
57 | + $this->server->on('method:UNLOCK', [$this, 'fakeUnlockProvider'], 1); |
|
58 | + $server->on('propFind', [$this, 'propFind']); |
|
59 | + $server->on('validateTokens', [$this, 'validateTokens']); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Indicate that we support LOCK and UNLOCK |
|
64 | - * |
|
65 | - * @param string $path |
|
66 | - * @return string[] |
|
67 | - */ |
|
68 | - public function getHTTPMethods($path) { |
|
69 | - return [ |
|
70 | - 'LOCK', |
|
71 | - 'UNLOCK', |
|
72 | - ]; |
|
73 | - } |
|
62 | + /** |
|
63 | + * Indicate that we support LOCK and UNLOCK |
|
64 | + * |
|
65 | + * @param string $path |
|
66 | + * @return string[] |
|
67 | + */ |
|
68 | + public function getHTTPMethods($path) { |
|
69 | + return [ |
|
70 | + 'LOCK', |
|
71 | + 'UNLOCK', |
|
72 | + ]; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Indicate that we support locking |
|
77 | - * |
|
78 | - * @return integer[] |
|
79 | - */ |
|
80 | - public function getFeatures() { |
|
81 | - return [2]; |
|
82 | - } |
|
75 | + /** |
|
76 | + * Indicate that we support locking |
|
77 | + * |
|
78 | + * @return integer[] |
|
79 | + */ |
|
80 | + public function getFeatures() { |
|
81 | + return [2]; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Return some dummy response for PROPFIND requests with regard to locking |
|
86 | - * |
|
87 | - * @param PropFind $propFind |
|
88 | - * @param INode $node |
|
89 | - * @return void |
|
90 | - */ |
|
91 | - public function propFind(PropFind $propFind, INode $node) { |
|
92 | - $propFind->handle('{DAV:}supportedlock', function () { |
|
93 | - return new SupportedLock(true); |
|
94 | - }); |
|
95 | - $propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) { |
|
96 | - return new LockDiscovery([]); |
|
97 | - }); |
|
98 | - } |
|
84 | + /** |
|
85 | + * Return some dummy response for PROPFIND requests with regard to locking |
|
86 | + * |
|
87 | + * @param PropFind $propFind |
|
88 | + * @param INode $node |
|
89 | + * @return void |
|
90 | + */ |
|
91 | + public function propFind(PropFind $propFind, INode $node) { |
|
92 | + $propFind->handle('{DAV:}supportedlock', function () { |
|
93 | + return new SupportedLock(true); |
|
94 | + }); |
|
95 | + $propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) { |
|
96 | + return new LockDiscovery([]); |
|
97 | + }); |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * Mark a locking token always as valid |
|
102 | - * |
|
103 | - * @param RequestInterface $request |
|
104 | - * @param array $conditions |
|
105 | - */ |
|
106 | - public function validateTokens(RequestInterface $request, &$conditions) { |
|
107 | - foreach ($conditions as &$fileCondition) { |
|
108 | - if (isset($fileCondition['tokens'])) { |
|
109 | - foreach ($fileCondition['tokens'] as &$token) { |
|
110 | - if (isset($token['token'])) { |
|
111 | - if (substr($token['token'], 0, 16) === 'opaquelocktoken:') { |
|
112 | - $token['validToken'] = true; |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
116 | - } |
|
117 | - } |
|
118 | - } |
|
100 | + /** |
|
101 | + * Mark a locking token always as valid |
|
102 | + * |
|
103 | + * @param RequestInterface $request |
|
104 | + * @param array $conditions |
|
105 | + */ |
|
106 | + public function validateTokens(RequestInterface $request, &$conditions) { |
|
107 | + foreach ($conditions as &$fileCondition) { |
|
108 | + if (isset($fileCondition['tokens'])) { |
|
109 | + foreach ($fileCondition['tokens'] as &$token) { |
|
110 | + if (isset($token['token'])) { |
|
111 | + if (substr($token['token'], 0, 16) === 'opaquelocktoken:') { |
|
112 | + $token['validToken'] = true; |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | + } |
|
117 | + } |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Fakes a successful LOCK |
|
122 | - * |
|
123 | - * @param RequestInterface $request |
|
124 | - * @param ResponseInterface $response |
|
125 | - * @return bool |
|
126 | - */ |
|
127 | - public function fakeLockProvider(RequestInterface $request, |
|
128 | - ResponseInterface $response) { |
|
129 | - $lockInfo = new LockInfo(); |
|
130 | - $lockInfo->token = md5($request->getPath()); |
|
131 | - $lockInfo->uri = $request->getPath(); |
|
132 | - $lockInfo->depth = \Sabre\DAV\Server::DEPTH_INFINITY; |
|
133 | - $lockInfo->timeout = 1800; |
|
120 | + /** |
|
121 | + * Fakes a successful LOCK |
|
122 | + * |
|
123 | + * @param RequestInterface $request |
|
124 | + * @param ResponseInterface $response |
|
125 | + * @return bool |
|
126 | + */ |
|
127 | + public function fakeLockProvider(RequestInterface $request, |
|
128 | + ResponseInterface $response) { |
|
129 | + $lockInfo = new LockInfo(); |
|
130 | + $lockInfo->token = md5($request->getPath()); |
|
131 | + $lockInfo->uri = $request->getPath(); |
|
132 | + $lockInfo->depth = \Sabre\DAV\Server::DEPTH_INFINITY; |
|
133 | + $lockInfo->timeout = 1800; |
|
134 | 134 | |
135 | - $body = $this->server->xml->write('{DAV:}prop', [ |
|
136 | - '{DAV:}lockdiscovery' => |
|
137 | - new LockDiscovery([$lockInfo]) |
|
138 | - ]); |
|
135 | + $body = $this->server->xml->write('{DAV:}prop', [ |
|
136 | + '{DAV:}lockdiscovery' => |
|
137 | + new LockDiscovery([$lockInfo]) |
|
138 | + ]); |
|
139 | 139 | |
140 | - $response->setStatus(200); |
|
141 | - $response->setBody($body); |
|
140 | + $response->setStatus(200); |
|
141 | + $response->setBody($body); |
|
142 | 142 | |
143 | - return false; |
|
144 | - } |
|
143 | + return false; |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Fakes a successful LOCK |
|
148 | - * |
|
149 | - * @param RequestInterface $request |
|
150 | - * @param ResponseInterface $response |
|
151 | - * @return bool |
|
152 | - */ |
|
153 | - public function fakeUnlockProvider(RequestInterface $request, |
|
154 | - ResponseInterface $response) { |
|
155 | - $response->setStatus(204); |
|
156 | - $response->setHeader('Content-Length', '0'); |
|
157 | - return false; |
|
158 | - } |
|
146 | + /** |
|
147 | + * Fakes a successful LOCK |
|
148 | + * |
|
149 | + * @param RequestInterface $request |
|
150 | + * @param ResponseInterface $response |
|
151 | + * @return bool |
|
152 | + */ |
|
153 | + public function fakeUnlockProvider(RequestInterface $request, |
|
154 | + ResponseInterface $response) { |
|
155 | + $response->setStatus(204); |
|
156 | + $response->setHeader('Content-Length', '0'); |
|
157 | + return false; |
|
158 | + } |
|
159 | 159 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | */ |
65 | 65 | public function xmlSerialize(Writer $writer) { |
66 | 66 | foreach ($this->checksums as $checksum) { |
67 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
67 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}checksum', $checksum); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -32,40 +32,40 @@ |
||
32 | 32 | * checksum name. |
33 | 33 | */ |
34 | 34 | class ChecksumList implements XmlSerializable { |
35 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
35 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
36 | 36 | |
37 | - /** @var string[] of TYPE:CHECKSUM */ |
|
38 | - private $checksums; |
|
37 | + /** @var string[] of TYPE:CHECKSUM */ |
|
38 | + private $checksums; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param string $checksum |
|
42 | - */ |
|
43 | - public function __construct($checksum) { |
|
44 | - $this->checksums = explode(',', $checksum); |
|
45 | - } |
|
40 | + /** |
|
41 | + * @param string $checksum |
|
42 | + */ |
|
43 | + public function __construct($checksum) { |
|
44 | + $this->checksums = explode(',', $checksum); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * The xmlSerialize metod is called during xml writing. |
|
49 | - * |
|
50 | - * Use the $writer argument to write its own xml serialization. |
|
51 | - * |
|
52 | - * An important note: do _not_ create a parent element. Any element |
|
53 | - * implementing XmlSerializble should only ever write what's considered |
|
54 | - * its 'inner xml'. |
|
55 | - * |
|
56 | - * The parent of the current element is responsible for writing a |
|
57 | - * containing element. |
|
58 | - * |
|
59 | - * This allows serializers to be re-used for different element names. |
|
60 | - * |
|
61 | - * If you are opening new elements, you must also close them again. |
|
62 | - * |
|
63 | - * @param Writer $writer |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function xmlSerialize(Writer $writer) { |
|
67 | - foreach ($this->checksums as $checksum) { |
|
68 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
69 | - } |
|
70 | - } |
|
47 | + /** |
|
48 | + * The xmlSerialize metod is called during xml writing. |
|
49 | + * |
|
50 | + * Use the $writer argument to write its own xml serialization. |
|
51 | + * |
|
52 | + * An important note: do _not_ create a parent element. Any element |
|
53 | + * implementing XmlSerializble should only ever write what's considered |
|
54 | + * its 'inner xml'. |
|
55 | + * |
|
56 | + * The parent of the current element is responsible for writing a |
|
57 | + * containing element. |
|
58 | + * |
|
59 | + * This allows serializers to be re-used for different element names. |
|
60 | + * |
|
61 | + * If you are opening new elements, you must also close them again. |
|
62 | + * |
|
63 | + * @param Writer $writer |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function xmlSerialize(Writer $writer) { |
|
67 | + foreach ($this->checksums as $checksum) { |
|
68 | + $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | return null; |
72 | 72 | } |
73 | 73 | foreach ($tree as $elem) { |
74 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}share-type') { |
|
75 | - $shareTypes[] = (int)$elem['value']; |
|
74 | + if ($elem['name'] === '{'.self::NS_OWNCLOUD.'}share-type') { |
|
75 | + $shareTypes[] = (int) $elem['value']; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | return new self($shareTypes); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function xmlSerialize(Writer $writer) { |
88 | 88 | foreach ($this->shareTypes as $shareType) { |
89 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); |
|
89 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}share-type', $shareType); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
@@ -32,61 +32,61 @@ |
||
32 | 32 | * This property contains multiple "share-type" elements, each containing a share type. |
33 | 33 | */ |
34 | 34 | class ShareTypeList implements Element { |
35 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
35 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Share types |
|
39 | - * |
|
40 | - * @var int[] |
|
41 | - */ |
|
42 | - private $shareTypes; |
|
37 | + /** |
|
38 | + * Share types |
|
39 | + * |
|
40 | + * @var int[] |
|
41 | + */ |
|
42 | + private $shareTypes; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param int[] $shareTypes |
|
46 | - */ |
|
47 | - public function __construct($shareTypes) { |
|
48 | - $this->shareTypes = $shareTypes; |
|
49 | - } |
|
44 | + /** |
|
45 | + * @param int[] $shareTypes |
|
46 | + */ |
|
47 | + public function __construct($shareTypes) { |
|
48 | + $this->shareTypes = $shareTypes; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Returns the share types |
|
53 | - * |
|
54 | - * @return int[] |
|
55 | - */ |
|
56 | - public function getShareTypes() { |
|
57 | - return $this->shareTypes; |
|
58 | - } |
|
51 | + /** |
|
52 | + * Returns the share types |
|
53 | + * |
|
54 | + * @return int[] |
|
55 | + */ |
|
56 | + public function getShareTypes() { |
|
57 | + return $this->shareTypes; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * The deserialize method is called during xml parsing. |
|
62 | - * |
|
63 | - * @param Reader $reader |
|
64 | - * @return mixed |
|
65 | - */ |
|
66 | - public static function xmlDeserialize(Reader $reader) { |
|
67 | - $shareTypes = []; |
|
60 | + /** |
|
61 | + * The deserialize method is called during xml parsing. |
|
62 | + * |
|
63 | + * @param Reader $reader |
|
64 | + * @return mixed |
|
65 | + */ |
|
66 | + public static function xmlDeserialize(Reader $reader) { |
|
67 | + $shareTypes = []; |
|
68 | 68 | |
69 | - $tree = $reader->parseInnerTree(); |
|
70 | - if ($tree === null) { |
|
71 | - return null; |
|
72 | - } |
|
73 | - foreach ($tree as $elem) { |
|
74 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}share-type') { |
|
75 | - $shareTypes[] = (int)$elem['value']; |
|
76 | - } |
|
77 | - } |
|
78 | - return new self($shareTypes); |
|
79 | - } |
|
69 | + $tree = $reader->parseInnerTree(); |
|
70 | + if ($tree === null) { |
|
71 | + return null; |
|
72 | + } |
|
73 | + foreach ($tree as $elem) { |
|
74 | + if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}share-type') { |
|
75 | + $shareTypes[] = (int)$elem['value']; |
|
76 | + } |
|
77 | + } |
|
78 | + return new self($shareTypes); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * The xmlSerialize metod is called during xml writing. |
|
83 | - * |
|
84 | - * @param Writer $writer |
|
85 | - * @return void |
|
86 | - */ |
|
87 | - public function xmlSerialize(Writer $writer) { |
|
88 | - foreach ($this->shareTypes as $shareType) { |
|
89 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); |
|
90 | - } |
|
91 | - } |
|
81 | + /** |
|
82 | + * The xmlSerialize metod is called during xml writing. |
|
83 | + * |
|
84 | + * @param Writer $writer |
|
85 | + * @return void |
|
86 | + */ |
|
87 | + public function xmlSerialize(Writer $writer) { |
|
88 | + foreach ($this->shareTypes as $shareType) { |
|
89 | + $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); |
|
90 | + } |
|
91 | + } |
|
92 | 92 | } |
@@ -108,7 +108,7 @@ |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | - throw new NotFound('Node with name \'' . $name . '\' could not be found'); |
|
111 | + throw new NotFound('Node with name \''.$name.'\' could not be found'); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -44,166 +44,166 @@ |
||
44 | 44 | |
45 | 45 | class CalendarHome extends \Sabre\CalDAV\CalendarHome { |
46 | 46 | |
47 | - /** @var \OCP\IL10N */ |
|
48 | - private $l10n; |
|
49 | - |
|
50 | - /** @var \OCP\IConfig */ |
|
51 | - private $config; |
|
52 | - |
|
53 | - /** @var PluginManager */ |
|
54 | - private $pluginManager; |
|
55 | - |
|
56 | - /** @var bool */ |
|
57 | - private $returnCachedSubscriptions = false; |
|
58 | - |
|
59 | - public function __construct(BackendInterface $caldavBackend, $principalInfo) { |
|
60 | - parent::__construct($caldavBackend, $principalInfo); |
|
61 | - $this->l10n = \OC::$server->getL10N('dav'); |
|
62 | - $this->config = \OC::$server->getConfig(); |
|
63 | - $this->pluginManager = new PluginManager( |
|
64 | - \OC::$server, |
|
65 | - \OC::$server->getAppManager() |
|
66 | - ); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * @return BackendInterface |
|
71 | - */ |
|
72 | - public function getCalDAVBackend() { |
|
73 | - return $this->caldavBackend; |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * @inheritdoc |
|
78 | - */ |
|
79 | - public function createExtendedCollection($name, MkCol $mkCol): void { |
|
80 | - $reservedNames = [ |
|
81 | - BirthdayService::BIRTHDAY_CALENDAR_URI, |
|
82 | - TrashbinHome::NAME, |
|
83 | - ]; |
|
84 | - |
|
85 | - if (\in_array($name, $reservedNames, true) || ExternalCalendar::doesViolateReservedName($name)) { |
|
86 | - throw new MethodNotAllowed('The resource you tried to create has a reserved name'); |
|
87 | - } |
|
88 | - |
|
89 | - parent::createExtendedCollection($name, $mkCol); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @inheritdoc |
|
94 | - */ |
|
95 | - public function getChildren() { |
|
96 | - $calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']); |
|
97 | - $objects = []; |
|
98 | - foreach ($calendars as $calendar) { |
|
99 | - $objects[] = new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
100 | - } |
|
101 | - |
|
102 | - if ($this->caldavBackend instanceof SchedulingSupport) { |
|
103 | - $objects[] = new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
104 | - $objects[] = new Outbox($this->config, $this->principalInfo['uri']); |
|
105 | - } |
|
106 | - |
|
107 | - // We're adding a notifications node, if it's supported by the backend. |
|
108 | - if ($this->caldavBackend instanceof NotificationSupport) { |
|
109 | - $objects[] = new \Sabre\CalDAV\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
110 | - } |
|
111 | - |
|
112 | - if ($this->caldavBackend instanceof CalDavBackend) { |
|
113 | - $objects[] = new TrashbinHome($this->caldavBackend, $this->principalInfo); |
|
114 | - } |
|
115 | - |
|
116 | - // If the backend supports subscriptions, we'll add those as well, |
|
117 | - if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
118 | - foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
119 | - if ($this->returnCachedSubscriptions) { |
|
120 | - $objects[] = new CachedSubscription($this->caldavBackend, $subscription); |
|
121 | - } else { |
|
122 | - $objects[] = new Subscription($this->caldavBackend, $subscription); |
|
123 | - } |
|
124 | - } |
|
125 | - } |
|
126 | - |
|
127 | - foreach ($this->pluginManager->getCalendarPlugins() as $calendarPlugin) { |
|
128 | - /** @var ICalendarProvider $calendarPlugin */ |
|
129 | - $calendars = $calendarPlugin->fetchAllForCalendarHome($this->principalInfo['uri']); |
|
130 | - foreach ($calendars as $calendar) { |
|
131 | - $objects[] = $calendar; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - return $objects; |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * @param string $name |
|
140 | - * |
|
141 | - * @return INode |
|
142 | - */ |
|
143 | - public function getChild($name) { |
|
144 | - // Special nodes |
|
145 | - if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
146 | - return new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
147 | - } |
|
148 | - if ($name === 'outbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
149 | - return new Outbox($this->config, $this->principalInfo['uri']); |
|
150 | - } |
|
151 | - if ($name === 'notifications' && $this->caldavBackend instanceof NotificationSupport) { |
|
152 | - return new \Sabre\CalDAV\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
153 | - } |
|
154 | - if ($name === TrashbinHome::NAME && $this->caldavBackend instanceof CalDavBackend) { |
|
155 | - return new TrashbinHome($this->caldavBackend, $this->principalInfo); |
|
156 | - } |
|
157 | - |
|
158 | - // Calendars |
|
159 | - foreach ($this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']) as $calendar) { |
|
160 | - if ($calendar['uri'] === $name) { |
|
161 | - return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
166 | - foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
167 | - if ($subscription['uri'] === $name) { |
|
168 | - if ($this->returnCachedSubscriptions) { |
|
169 | - return new CachedSubscription($this->caldavBackend, $subscription); |
|
170 | - } |
|
171 | - |
|
172 | - return new Subscription($this->caldavBackend, $subscription); |
|
173 | - } |
|
174 | - } |
|
175 | - } |
|
176 | - |
|
177 | - if (ExternalCalendar::isAppGeneratedCalendar($name)) { |
|
178 | - [$appId, $calendarUri] = ExternalCalendar::splitAppGeneratedCalendarUri($name); |
|
179 | - |
|
180 | - foreach ($this->pluginManager->getCalendarPlugins() as $calendarPlugin) { |
|
181 | - /** @var ICalendarProvider $calendarPlugin */ |
|
182 | - if ($calendarPlugin->getAppId() !== $appId) { |
|
183 | - continue; |
|
184 | - } |
|
185 | - |
|
186 | - if ($calendarPlugin->hasCalendarInCalendarHome($this->principalInfo['uri'], $calendarUri)) { |
|
187 | - return $calendarPlugin->getCalendarInCalendarHome($this->principalInfo['uri'], $calendarUri); |
|
188 | - } |
|
189 | - } |
|
190 | - } |
|
191 | - |
|
192 | - throw new NotFound('Node with name \'' . $name . '\' could not be found'); |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * @param array $filters |
|
197 | - * @param integer|null $limit |
|
198 | - * @param integer|null $offset |
|
199 | - */ |
|
200 | - public function calendarSearch(array $filters, $limit = null, $offset = null) { |
|
201 | - $principalUri = $this->principalInfo['uri']; |
|
202 | - return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset); |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - public function enableCachedSubscriptionsForThisRequest() { |
|
207 | - $this->returnCachedSubscriptions = true; |
|
208 | - } |
|
47 | + /** @var \OCP\IL10N */ |
|
48 | + private $l10n; |
|
49 | + |
|
50 | + /** @var \OCP\IConfig */ |
|
51 | + private $config; |
|
52 | + |
|
53 | + /** @var PluginManager */ |
|
54 | + private $pluginManager; |
|
55 | + |
|
56 | + /** @var bool */ |
|
57 | + private $returnCachedSubscriptions = false; |
|
58 | + |
|
59 | + public function __construct(BackendInterface $caldavBackend, $principalInfo) { |
|
60 | + parent::__construct($caldavBackend, $principalInfo); |
|
61 | + $this->l10n = \OC::$server->getL10N('dav'); |
|
62 | + $this->config = \OC::$server->getConfig(); |
|
63 | + $this->pluginManager = new PluginManager( |
|
64 | + \OC::$server, |
|
65 | + \OC::$server->getAppManager() |
|
66 | + ); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * @return BackendInterface |
|
71 | + */ |
|
72 | + public function getCalDAVBackend() { |
|
73 | + return $this->caldavBackend; |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * @inheritdoc |
|
78 | + */ |
|
79 | + public function createExtendedCollection($name, MkCol $mkCol): void { |
|
80 | + $reservedNames = [ |
|
81 | + BirthdayService::BIRTHDAY_CALENDAR_URI, |
|
82 | + TrashbinHome::NAME, |
|
83 | + ]; |
|
84 | + |
|
85 | + if (\in_array($name, $reservedNames, true) || ExternalCalendar::doesViolateReservedName($name)) { |
|
86 | + throw new MethodNotAllowed('The resource you tried to create has a reserved name'); |
|
87 | + } |
|
88 | + |
|
89 | + parent::createExtendedCollection($name, $mkCol); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @inheritdoc |
|
94 | + */ |
|
95 | + public function getChildren() { |
|
96 | + $calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']); |
|
97 | + $objects = []; |
|
98 | + foreach ($calendars as $calendar) { |
|
99 | + $objects[] = new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
100 | + } |
|
101 | + |
|
102 | + if ($this->caldavBackend instanceof SchedulingSupport) { |
|
103 | + $objects[] = new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
104 | + $objects[] = new Outbox($this->config, $this->principalInfo['uri']); |
|
105 | + } |
|
106 | + |
|
107 | + // We're adding a notifications node, if it's supported by the backend. |
|
108 | + if ($this->caldavBackend instanceof NotificationSupport) { |
|
109 | + $objects[] = new \Sabre\CalDAV\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
110 | + } |
|
111 | + |
|
112 | + if ($this->caldavBackend instanceof CalDavBackend) { |
|
113 | + $objects[] = new TrashbinHome($this->caldavBackend, $this->principalInfo); |
|
114 | + } |
|
115 | + |
|
116 | + // If the backend supports subscriptions, we'll add those as well, |
|
117 | + if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
118 | + foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
119 | + if ($this->returnCachedSubscriptions) { |
|
120 | + $objects[] = new CachedSubscription($this->caldavBackend, $subscription); |
|
121 | + } else { |
|
122 | + $objects[] = new Subscription($this->caldavBackend, $subscription); |
|
123 | + } |
|
124 | + } |
|
125 | + } |
|
126 | + |
|
127 | + foreach ($this->pluginManager->getCalendarPlugins() as $calendarPlugin) { |
|
128 | + /** @var ICalendarProvider $calendarPlugin */ |
|
129 | + $calendars = $calendarPlugin->fetchAllForCalendarHome($this->principalInfo['uri']); |
|
130 | + foreach ($calendars as $calendar) { |
|
131 | + $objects[] = $calendar; |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + return $objects; |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * @param string $name |
|
140 | + * |
|
141 | + * @return INode |
|
142 | + */ |
|
143 | + public function getChild($name) { |
|
144 | + // Special nodes |
|
145 | + if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
146 | + return new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
147 | + } |
|
148 | + if ($name === 'outbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
149 | + return new Outbox($this->config, $this->principalInfo['uri']); |
|
150 | + } |
|
151 | + if ($name === 'notifications' && $this->caldavBackend instanceof NotificationSupport) { |
|
152 | + return new \Sabre\CalDAV\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
153 | + } |
|
154 | + if ($name === TrashbinHome::NAME && $this->caldavBackend instanceof CalDavBackend) { |
|
155 | + return new TrashbinHome($this->caldavBackend, $this->principalInfo); |
|
156 | + } |
|
157 | + |
|
158 | + // Calendars |
|
159 | + foreach ($this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']) as $calendar) { |
|
160 | + if ($calendar['uri'] === $name) { |
|
161 | + return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
166 | + foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
167 | + if ($subscription['uri'] === $name) { |
|
168 | + if ($this->returnCachedSubscriptions) { |
|
169 | + return new CachedSubscription($this->caldavBackend, $subscription); |
|
170 | + } |
|
171 | + |
|
172 | + return new Subscription($this->caldavBackend, $subscription); |
|
173 | + } |
|
174 | + } |
|
175 | + } |
|
176 | + |
|
177 | + if (ExternalCalendar::isAppGeneratedCalendar($name)) { |
|
178 | + [$appId, $calendarUri] = ExternalCalendar::splitAppGeneratedCalendarUri($name); |
|
179 | + |
|
180 | + foreach ($this->pluginManager->getCalendarPlugins() as $calendarPlugin) { |
|
181 | + /** @var ICalendarProvider $calendarPlugin */ |
|
182 | + if ($calendarPlugin->getAppId() !== $appId) { |
|
183 | + continue; |
|
184 | + } |
|
185 | + |
|
186 | + if ($calendarPlugin->hasCalendarInCalendarHome($this->principalInfo['uri'], $calendarUri)) { |
|
187 | + return $calendarPlugin->getCalendarInCalendarHome($this->principalInfo['uri'], $calendarUri); |
|
188 | + } |
|
189 | + } |
|
190 | + } |
|
191 | + |
|
192 | + throw new NotFound('Node with name \'' . $name . '\' could not be found'); |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * @param array $filters |
|
197 | + * @param integer|null $limit |
|
198 | + * @param integer|null $offset |
|
199 | + */ |
|
200 | + public function calendarSearch(array $filters, $limit = null, $offset = null) { |
|
201 | + $principalUri = $this->principalInfo['uri']; |
|
202 | + return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset); |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + public function enableCachedSubscriptionsForThisRequest() { |
|
207 | + $this->returnCachedSubscriptions = true; |
|
208 | + } |
|
209 | 209 | } |
@@ -25,58 +25,58 @@ |
||
25 | 25 | |
26 | 26 | class Publisher implements XmlSerializable { |
27 | 27 | |
28 | - /** |
|
29 | - * @var string $publishUrl |
|
30 | - */ |
|
31 | - protected $publishUrl; |
|
28 | + /** |
|
29 | + * @var string $publishUrl |
|
30 | + */ |
|
31 | + protected $publishUrl; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @var boolean $isPublished |
|
35 | - */ |
|
36 | - protected $isPublished; |
|
33 | + /** |
|
34 | + * @var boolean $isPublished |
|
35 | + */ |
|
36 | + protected $isPublished; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $publishUrl |
|
40 | - * @param boolean $isPublished |
|
41 | - */ |
|
42 | - public function __construct($publishUrl, $isPublished) { |
|
43 | - $this->publishUrl = $publishUrl; |
|
44 | - $this->isPublished = $isPublished; |
|
45 | - } |
|
38 | + /** |
|
39 | + * @param string $publishUrl |
|
40 | + * @param boolean $isPublished |
|
41 | + */ |
|
42 | + public function __construct($publishUrl, $isPublished) { |
|
43 | + $this->publishUrl = $publishUrl; |
|
44 | + $this->isPublished = $isPublished; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return string |
|
49 | - */ |
|
50 | - public function getValue() { |
|
51 | - return $this->publishUrl; |
|
52 | - } |
|
47 | + /** |
|
48 | + * @return string |
|
49 | + */ |
|
50 | + public function getValue() { |
|
51 | + return $this->publishUrl; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * The xmlSerialize metod is called during xml writing. |
|
56 | - * |
|
57 | - * Use the $writer argument to write its own xml serialization. |
|
58 | - * |
|
59 | - * An important note: do _not_ create a parent element. Any element |
|
60 | - * implementing XmlSerializble should only ever write what's considered |
|
61 | - * its 'inner xml'. |
|
62 | - * |
|
63 | - * The parent of the current element is responsible for writing a |
|
64 | - * containing element. |
|
65 | - * |
|
66 | - * This allows serializers to be re-used for different element names. |
|
67 | - * |
|
68 | - * If you are opening new elements, you must also close them again. |
|
69 | - * |
|
70 | - * @param Writer $writer |
|
71 | - * @return void |
|
72 | - */ |
|
73 | - public function xmlSerialize(Writer $writer) { |
|
74 | - if (!$this->isPublished) { |
|
75 | - // for pre-publish-url |
|
76 | - $writer->write($this->publishUrl); |
|
77 | - } else { |
|
78 | - // for publish-url |
|
79 | - $writer->writeElement('{DAV:}href', $this->publishUrl); |
|
80 | - } |
|
81 | - } |
|
54 | + /** |
|
55 | + * The xmlSerialize metod is called during xml writing. |
|
56 | + * |
|
57 | + * Use the $writer argument to write its own xml serialization. |
|
58 | + * |
|
59 | + * An important note: do _not_ create a parent element. Any element |
|
60 | + * implementing XmlSerializble should only ever write what's considered |
|
61 | + * its 'inner xml'. |
|
62 | + * |
|
63 | + * The parent of the current element is responsible for writing a |
|
64 | + * containing element. |
|
65 | + * |
|
66 | + * This allows serializers to be re-used for different element names. |
|
67 | + * |
|
68 | + * If you are opening new elements, you must also close them again. |
|
69 | + * |
|
70 | + * @param Writer $writer |
|
71 | + * @return void |
|
72 | + */ |
|
73 | + public function xmlSerialize(Writer $writer) { |
|
74 | + if (!$this->isPublished) { |
|
75 | + // for pre-publish-url |
|
76 | + $writer->write($this->publishUrl); |
|
77 | + } else { |
|
78 | + // for publish-url |
|
79 | + $writer->writeElement('{DAV:}href', $this->publishUrl); |
|
80 | + } |
|
81 | + } |
|
82 | 82 | } |
@@ -23,11 +23,11 @@ |
||
23 | 23 | |
24 | 24 | class PublicCalendarObject extends CalendarObject { |
25 | 25 | |
26 | - /** |
|
27 | - * public calendars are always shared |
|
28 | - * @return bool |
|
29 | - */ |
|
30 | - protected function isShared() { |
|
31 | - return true; |
|
32 | - } |
|
26 | + /** |
|
27 | + * public calendars are always shared |
|
28 | + * @return bool |
|
29 | + */ |
|
30 | + protected function isShared() { |
|
31 | + return true; |
|
32 | + } |
|
33 | 33 | } |
@@ -27,17 +27,17 @@ |
||
27 | 27 | |
28 | 28 | class SearchTermFilter implements XmlDeserializable { |
29 | 29 | |
30 | - /** |
|
31 | - * @param Reader $reader |
|
32 | - * @throws BadRequest |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public 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 | + public 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 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | public 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; |