@@ -16,138 +16,138 @@ |
||
16 | 16 | */ |
17 | 17 | class File extends Node implements DAV\PartialUpdate\IPatchSupport |
18 | 18 | { |
19 | - /** |
|
20 | - * Updates the data. |
|
21 | - * |
|
22 | - * Data is a readable stream resource. |
|
23 | - * |
|
24 | - * @param resource|string $data |
|
25 | - * |
|
26 | - * @return string |
|
27 | - */ |
|
28 | - public function put($data) |
|
29 | - { |
|
30 | - file_put_contents($this->path, $data); |
|
31 | - clearstatcache(true, $this->path); |
|
19 | + /** |
|
20 | + * Updates the data. |
|
21 | + * |
|
22 | + * Data is a readable stream resource. |
|
23 | + * |
|
24 | + * @param resource|string $data |
|
25 | + * |
|
26 | + * @return string |
|
27 | + */ |
|
28 | + public function put($data) |
|
29 | + { |
|
30 | + file_put_contents($this->path, $data); |
|
31 | + clearstatcache(true, $this->path); |
|
32 | 32 | |
33 | - return $this->getETag(); |
|
34 | - } |
|
33 | + return $this->getETag(); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Updates the file based on a range specification. |
|
38 | - * |
|
39 | - * The first argument is the data, which is either a readable stream |
|
40 | - * resource or a string. |
|
41 | - * |
|
42 | - * The second argument is the type of update we're doing. |
|
43 | - * This is either: |
|
44 | - * * 1. append (default) |
|
45 | - * * 2. update based on a start byte |
|
46 | - * * 3. update based on an end byte |
|
47 | - *; |
|
48 | - * The third argument is the start or end byte. |
|
49 | - * |
|
50 | - * After a successful put operation, you may choose to return an ETag. The |
|
51 | - * ETAG must always be surrounded by double-quotes. These quotes must |
|
52 | - * appear in the actual string you're returning. |
|
53 | - * |
|
54 | - * Clients may use the ETag from a PUT request to later on make sure that |
|
55 | - * when they update the file, the contents haven't changed in the mean |
|
56 | - * time. |
|
57 | - * |
|
58 | - * @param resource|string $data |
|
59 | - * @param int $rangeType |
|
60 | - * @param int $offset |
|
61 | - * |
|
62 | - * @return string|null |
|
63 | - */ |
|
64 | - public function patch($data, $rangeType, $offset = null) |
|
65 | - { |
|
66 | - switch ($rangeType) { |
|
67 | - case 1: |
|
68 | - $f = fopen($this->path, 'a'); |
|
69 | - break; |
|
70 | - case 2: |
|
71 | - $f = fopen($this->path, 'c'); |
|
72 | - fseek($f, $offset); |
|
73 | - break; |
|
74 | - case 3: |
|
75 | - $f = fopen($this->path, 'c'); |
|
76 | - fseek($f, $offset, SEEK_END); |
|
77 | - break; |
|
78 | - default: |
|
79 | - $f = fopen($this->path, 'a'); |
|
80 | - break; |
|
81 | - } |
|
82 | - if (is_string($data)) { |
|
83 | - fwrite($f, $data); |
|
84 | - } else { |
|
85 | - stream_copy_to_stream($data, $f); |
|
86 | - } |
|
87 | - fclose($f); |
|
88 | - clearstatcache(true, $this->path); |
|
36 | + /** |
|
37 | + * Updates the file based on a range specification. |
|
38 | + * |
|
39 | + * The first argument is the data, which is either a readable stream |
|
40 | + * resource or a string. |
|
41 | + * |
|
42 | + * The second argument is the type of update we're doing. |
|
43 | + * This is either: |
|
44 | + * * 1. append (default) |
|
45 | + * * 2. update based on a start byte |
|
46 | + * * 3. update based on an end byte |
|
47 | + *; |
|
48 | + * The third argument is the start or end byte. |
|
49 | + * |
|
50 | + * After a successful put operation, you may choose to return an ETag. The |
|
51 | + * ETAG must always be surrounded by double-quotes. These quotes must |
|
52 | + * appear in the actual string you're returning. |
|
53 | + * |
|
54 | + * Clients may use the ETag from a PUT request to later on make sure that |
|
55 | + * when they update the file, the contents haven't changed in the mean |
|
56 | + * time. |
|
57 | + * |
|
58 | + * @param resource|string $data |
|
59 | + * @param int $rangeType |
|
60 | + * @param int $offset |
|
61 | + * |
|
62 | + * @return string|null |
|
63 | + */ |
|
64 | + public function patch($data, $rangeType, $offset = null) |
|
65 | + { |
|
66 | + switch ($rangeType) { |
|
67 | + case 1: |
|
68 | + $f = fopen($this->path, 'a'); |
|
69 | + break; |
|
70 | + case 2: |
|
71 | + $f = fopen($this->path, 'c'); |
|
72 | + fseek($f, $offset); |
|
73 | + break; |
|
74 | + case 3: |
|
75 | + $f = fopen($this->path, 'c'); |
|
76 | + fseek($f, $offset, SEEK_END); |
|
77 | + break; |
|
78 | + default: |
|
79 | + $f = fopen($this->path, 'a'); |
|
80 | + break; |
|
81 | + } |
|
82 | + if (is_string($data)) { |
|
83 | + fwrite($f, $data); |
|
84 | + } else { |
|
85 | + stream_copy_to_stream($data, $f); |
|
86 | + } |
|
87 | + fclose($f); |
|
88 | + clearstatcache(true, $this->path); |
|
89 | 89 | |
90 | - return $this->getETag(); |
|
91 | - } |
|
90 | + return $this->getETag(); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Returns the data. |
|
95 | - * |
|
96 | - * @return resource |
|
97 | - */ |
|
98 | - public function get() |
|
99 | - { |
|
100 | - return fopen($this->path, 'r'); |
|
101 | - } |
|
93 | + /** |
|
94 | + * Returns the data. |
|
95 | + * |
|
96 | + * @return resource |
|
97 | + */ |
|
98 | + public function get() |
|
99 | + { |
|
100 | + return fopen($this->path, 'r'); |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Delete the current file. |
|
105 | - * |
|
106 | - * @return bool |
|
107 | - */ |
|
108 | - public function delete() |
|
109 | - { |
|
110 | - return unlink($this->path); |
|
111 | - } |
|
103 | + /** |
|
104 | + * Delete the current file. |
|
105 | + * |
|
106 | + * @return bool |
|
107 | + */ |
|
108 | + public function delete() |
|
109 | + { |
|
110 | + return unlink($this->path); |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Returns the ETag for a file. |
|
115 | - * |
|
116 | - * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. |
|
117 | - * The ETag is an arbitrary string, but MUST be surrounded by double-quotes. |
|
118 | - * |
|
119 | - * Return null if the ETag can not effectively be determined |
|
120 | - * |
|
121 | - * @return string|null |
|
122 | - */ |
|
123 | - public function getETag() |
|
124 | - { |
|
125 | - return '"'.sha1( |
|
126 | - fileinode($this->path). |
|
127 | - filesize($this->path). |
|
128 | - filemtime($this->path) |
|
129 | - ).'"'; |
|
130 | - } |
|
113 | + /** |
|
114 | + * Returns the ETag for a file. |
|
115 | + * |
|
116 | + * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. |
|
117 | + * The ETag is an arbitrary string, but MUST be surrounded by double-quotes. |
|
118 | + * |
|
119 | + * Return null if the ETag can not effectively be determined |
|
120 | + * |
|
121 | + * @return string|null |
|
122 | + */ |
|
123 | + public function getETag() |
|
124 | + { |
|
125 | + return '"'.sha1( |
|
126 | + fileinode($this->path). |
|
127 | + filesize($this->path). |
|
128 | + filemtime($this->path) |
|
129 | + ).'"'; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Returns the mime-type for a file. |
|
134 | - * |
|
135 | - * If null is returned, we'll assume application/octet-stream |
|
136 | - * |
|
137 | - * @return string|null |
|
138 | - */ |
|
139 | - public function getContentType() |
|
140 | - { |
|
141 | - return null; |
|
142 | - } |
|
132 | + /** |
|
133 | + * Returns the mime-type for a file. |
|
134 | + * |
|
135 | + * If null is returned, we'll assume application/octet-stream |
|
136 | + * |
|
137 | + * @return string|null |
|
138 | + */ |
|
139 | + public function getContentType() |
|
140 | + { |
|
141 | + return null; |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * Returns the size of the file, in bytes. |
|
146 | - * |
|
147 | - * @return int |
|
148 | - */ |
|
149 | - public function getSize() |
|
150 | - { |
|
151 | - return filesize($this->path); |
|
152 | - } |
|
144 | + /** |
|
145 | + * Returns the size of the file, in bytes. |
|
146 | + * |
|
147 | + * @return int |
|
148 | + */ |
|
149 | + public function getSize() |
|
150 | + { |
|
151 | + return filesize($this->path); |
|
152 | + } |
|
153 | 153 | } |
@@ -19,60 +19,60 @@ |
||
19 | 19 | */ |
20 | 20 | class Plugin extends DAV\ServerPlugin |
21 | 21 | { |
22 | - /** |
|
23 | - * Reference to Server class. |
|
24 | - * |
|
25 | - * @var DAV\Server |
|
26 | - */ |
|
27 | - protected $server; |
|
22 | + /** |
|
23 | + * Reference to Server class. |
|
24 | + * |
|
25 | + * @var DAV\Server |
|
26 | + */ |
|
27 | + protected $server; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Initializes the plugin and registers event handles. |
|
31 | - */ |
|
32 | - public function initialize(DAV\Server $server) |
|
33 | - { |
|
34 | - $this->server = $server; |
|
35 | - $this->server->on('method:GET', [$this, 'httpGet'], 90); |
|
36 | - } |
|
29 | + /** |
|
30 | + * Initializes the plugin and registers event handles. |
|
31 | + */ |
|
32 | + public function initialize(DAV\Server $server) |
|
33 | + { |
|
34 | + $this->server = $server; |
|
35 | + $this->server->on('method:GET', [$this, 'httpGet'], 90); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * 'beforeMethod' event handles. This event handles intercepts GET requests ending |
|
40 | - * with ?mount. |
|
41 | - * |
|
42 | - * @return bool |
|
43 | - */ |
|
44 | - public function httpGet(RequestInterface $request, ResponseInterface $response) |
|
45 | - { |
|
46 | - $queryParams = $request->getQueryParameters(); |
|
47 | - if (!array_key_exists('mount', $queryParams)) { |
|
48 | - return; |
|
49 | - } |
|
38 | + /** |
|
39 | + * 'beforeMethod' event handles. This event handles intercepts GET requests ending |
|
40 | + * with ?mount. |
|
41 | + * |
|
42 | + * @return bool |
|
43 | + */ |
|
44 | + public function httpGet(RequestInterface $request, ResponseInterface $response) |
|
45 | + { |
|
46 | + $queryParams = $request->getQueryParameters(); |
|
47 | + if (!array_key_exists('mount', $queryParams)) { |
|
48 | + return; |
|
49 | + } |
|
50 | 50 | |
51 | - $currentUri = $request->getAbsoluteUrl(); |
|
51 | + $currentUri = $request->getAbsoluteUrl(); |
|
52 | 52 | |
53 | - // Stripping off everything after the ? |
|
54 | - list($currentUri) = explode('?', $currentUri); |
|
53 | + // Stripping off everything after the ? |
|
54 | + list($currentUri) = explode('?', $currentUri); |
|
55 | 55 | |
56 | - $this->davMount($response, $currentUri); |
|
56 | + $this->davMount($response, $currentUri); |
|
57 | 57 | |
58 | - // Returning false to break the event chain |
|
59 | - return false; |
|
60 | - } |
|
58 | + // Returning false to break the event chain |
|
59 | + return false; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Generates the davmount response. |
|
64 | - * |
|
65 | - * @param string $uri absolute uri |
|
66 | - */ |
|
67 | - public function davMount(ResponseInterface $response, $uri) |
|
68 | - { |
|
69 | - $response->setStatus(200); |
|
70 | - $response->setHeader('Content-Type', 'application/davmount+xml'); |
|
71 | - ob_start(); |
|
72 | - echo '<?xml version="1.0"?>', "\n"; |
|
73 | - echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n"; |
|
74 | - echo ' <dm:url>', htmlspecialchars($uri, ENT_NOQUOTES, 'UTF-8'), "</dm:url>\n"; |
|
75 | - echo '</dm:mount>'; |
|
76 | - $response->setBody(ob_get_clean()); |
|
77 | - } |
|
62 | + /** |
|
63 | + * Generates the davmount response. |
|
64 | + * |
|
65 | + * @param string $uri absolute uri |
|
66 | + */ |
|
67 | + public function davMount(ResponseInterface $response, $uri) |
|
68 | + { |
|
69 | + $response->setStatus(200); |
|
70 | + $response->setHeader('Content-Type', 'application/davmount+xml'); |
|
71 | + ob_start(); |
|
72 | + echo '<?xml version="1.0"?>', "\n"; |
|
73 | + echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n"; |
|
74 | + echo ' <dm:url>', htmlspecialchars($uri, ENT_NOQUOTES, 'UTF-8'), "</dm:url>\n"; |
|
75 | + echo '</dm:mount>'; |
|
76 | + $response->setBody(ob_get_clean()); |
|
77 | + } |
|
78 | 78 | } |
@@ -24,15 +24,15 @@ |
||
24 | 24 | */ |
25 | 25 | interface IMultiGet extends ICollection |
26 | 26 | { |
27 | - /** |
|
28 | - * This method receives a list of paths in it's first argument. |
|
29 | - * It must return an array with Node objects. |
|
30 | - * |
|
31 | - * If any children are not found, you do not have to return them. |
|
32 | - * |
|
33 | - * @param string[] $paths |
|
34 | - * |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function getMultipleChildren(array $paths); |
|
27 | + /** |
|
28 | + * This method receives a list of paths in it's first argument. |
|
29 | + * It must return an array with Node objects. |
|
30 | + * |
|
31 | + * If any children are not found, you do not have to return them. |
|
32 | + * |
|
33 | + * @param string[] $paths |
|
34 | + * |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function getMultipleChildren(array $paths); |
|
38 | 38 | } |
@@ -17,70 +17,70 @@ |
||
17 | 17 | */ |
18 | 18 | class StringUtil |
19 | 19 | { |
20 | - /** |
|
21 | - * Checks if a needle occurs in a haystack ;). |
|
22 | - * |
|
23 | - * @param string $haystack |
|
24 | - * @param string $needle |
|
25 | - * @param string $collation |
|
26 | - * @param string $matchType |
|
27 | - * |
|
28 | - * @return bool |
|
29 | - */ |
|
30 | - public static function textMatch($haystack, $needle, $collation, $matchType = 'contains') |
|
31 | - { |
|
32 | - switch ($collation) { |
|
33 | - case 'i;ascii-casemap': |
|
34 | - // default strtolower takes locale into consideration |
|
35 | - // we don't want this. |
|
36 | - $haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack); |
|
37 | - $needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle); |
|
38 | - break; |
|
20 | + /** |
|
21 | + * Checks if a needle occurs in a haystack ;). |
|
22 | + * |
|
23 | + * @param string $haystack |
|
24 | + * @param string $needle |
|
25 | + * @param string $collation |
|
26 | + * @param string $matchType |
|
27 | + * |
|
28 | + * @return bool |
|
29 | + */ |
|
30 | + public static function textMatch($haystack, $needle, $collation, $matchType = 'contains') |
|
31 | + { |
|
32 | + switch ($collation) { |
|
33 | + case 'i;ascii-casemap': |
|
34 | + // default strtolower takes locale into consideration |
|
35 | + // we don't want this. |
|
36 | + $haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack); |
|
37 | + $needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle); |
|
38 | + break; |
|
39 | 39 | |
40 | - case 'i;octet': |
|
41 | - // Do nothing |
|
42 | - break; |
|
40 | + case 'i;octet': |
|
41 | + // Do nothing |
|
42 | + break; |
|
43 | 43 | |
44 | - case 'i;unicode-casemap': |
|
45 | - $haystack = mb_strtoupper($haystack, 'UTF-8'); |
|
46 | - $needle = mb_strtoupper($needle, 'UTF-8'); |
|
47 | - break; |
|
44 | + case 'i;unicode-casemap': |
|
45 | + $haystack = mb_strtoupper($haystack, 'UTF-8'); |
|
46 | + $needle = mb_strtoupper($needle, 'UTF-8'); |
|
47 | + break; |
|
48 | 48 | |
49 | - default: |
|
50 | - throw new Exception\BadRequest('Collation type: '.$collation.' is not supported'); |
|
51 | - } |
|
49 | + default: |
|
50 | + throw new Exception\BadRequest('Collation type: '.$collation.' is not supported'); |
|
51 | + } |
|
52 | 52 | |
53 | - switch ($matchType) { |
|
54 | - case 'contains': |
|
55 | - return false !== strpos($haystack, $needle); |
|
56 | - case 'equals': |
|
57 | - return $haystack === $needle; |
|
58 | - case 'starts-with': |
|
59 | - return 0 === strpos($haystack, $needle); |
|
60 | - case 'ends-with': |
|
61 | - return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle); |
|
62 | - default: |
|
63 | - throw new Exception\BadRequest('Match-type: '.$matchType.' is not supported'); |
|
64 | - } |
|
65 | - } |
|
53 | + switch ($matchType) { |
|
54 | + case 'contains': |
|
55 | + return false !== strpos($haystack, $needle); |
|
56 | + case 'equals': |
|
57 | + return $haystack === $needle; |
|
58 | + case 'starts-with': |
|
59 | + return 0 === strpos($haystack, $needle); |
|
60 | + case 'ends-with': |
|
61 | + return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle); |
|
62 | + default: |
|
63 | + throw new Exception\BadRequest('Match-type: '.$matchType.' is not supported'); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * This method takes an input string, checks if it's not valid UTF-8 and |
|
69 | - * attempts to convert it to UTF-8 if it's not. |
|
70 | - * |
|
71 | - * Note that currently this can only convert ISO-8859-1 to UTF-8 (latin-1), |
|
72 | - * anything else will likely fail. |
|
73 | - * |
|
74 | - * @param string $input |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public static function ensureUTF8($input) |
|
79 | - { |
|
80 | - if (!mb_check_encoding($input, 'UTF-8') && mb_check_encoding($input, 'ISO-8859-1')) { |
|
81 | - return mb_convert_encoding($input, 'UTF-8', 'ISO-8859-1'); |
|
82 | - } else { |
|
83 | - return $input; |
|
84 | - } |
|
85 | - } |
|
67 | + /** |
|
68 | + * This method takes an input string, checks if it's not valid UTF-8 and |
|
69 | + * attempts to convert it to UTF-8 if it's not. |
|
70 | + * |
|
71 | + * Note that currently this can only convert ISO-8859-1 to UTF-8 (latin-1), |
|
72 | + * anything else will likely fail. |
|
73 | + * |
|
74 | + * @param string $input |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public static function ensureUTF8($input) |
|
79 | + { |
|
80 | + if (!mb_check_encoding($input, 'UTF-8') && mb_check_encoding($input, 'ISO-8859-1')) { |
|
81 | + return mb_convert_encoding($input, 'UTF-8', 'ISO-8859-1'); |
|
82 | + } else { |
|
83 | + return $input; |
|
84 | + } |
|
85 | + } |
|
86 | 86 | } |
@@ -18,13 +18,13 @@ |
||
18 | 18 | */ |
19 | 19 | class RequestedRangeNotSatisfiable extends DAV\Exception |
20 | 20 | { |
21 | - /** |
|
22 | - * returns the http statuscode for this exception. |
|
23 | - * |
|
24 | - * @return int |
|
25 | - */ |
|
26 | - public function getHTTPCode() |
|
27 | - { |
|
28 | - return 416; |
|
29 | - } |
|
21 | + /** |
|
22 | + * returns the http statuscode for this exception. |
|
23 | + * |
|
24 | + * @return int |
|
25 | + */ |
|
26 | + public function getHTTPCode() |
|
27 | + { |
|
28 | + return 416; |
|
29 | + } |
|
30 | 30 | } |
@@ -18,13 +18,13 @@ |
||
18 | 18 | */ |
19 | 19 | class LengthRequired extends DAV\Exception |
20 | 20 | { |
21 | - /** |
|
22 | - * Returns the HTTP statuscode for this exception. |
|
23 | - * |
|
24 | - * @return int |
|
25 | - */ |
|
26 | - public function getHTTPCode() |
|
27 | - { |
|
28 | - return 411; |
|
29 | - } |
|
21 | + /** |
|
22 | + * Returns the HTTP statuscode for this exception. |
|
23 | + * |
|
24 | + * @return int |
|
25 | + */ |
|
26 | + public function getHTTPCode() |
|
27 | + { |
|
28 | + return 411; |
|
29 | + } |
|
30 | 30 | } |
@@ -18,15 +18,15 @@ |
||
18 | 18 | */ |
19 | 19 | class ConflictingLock extends Locked |
20 | 20 | { |
21 | - /** |
|
22 | - * This method allows the exception to include additional information into the WebDAV error response. |
|
23 | - */ |
|
24 | - public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | - { |
|
26 | - if ($this->lock) { |
|
27 | - $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:no-conflicting-lock'); |
|
28 | - $errorNode->appendChild($error); |
|
29 | - $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:href', $this->lock->uri)); |
|
30 | - } |
|
31 | - } |
|
21 | + /** |
|
22 | + * This method allows the exception to include additional information into the WebDAV error response. |
|
23 | + */ |
|
24 | + public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | + { |
|
26 | + if ($this->lock) { |
|
27 | + $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:no-conflicting-lock'); |
|
28 | + $errorNode->appendChild($error); |
|
29 | + $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:href', $this->lock->uri)); |
|
30 | + } |
|
31 | + } |
|
32 | 32 | } |
@@ -18,13 +18,13 @@ |
||
18 | 18 | */ |
19 | 19 | class BadRequest extends DAV\Exception |
20 | 20 | { |
21 | - /** |
|
22 | - * Returns the HTTP statuscode for this exception. |
|
23 | - * |
|
24 | - * @return int |
|
25 | - */ |
|
26 | - public function getHTTPCode() |
|
27 | - { |
|
28 | - return 400; |
|
29 | - } |
|
21 | + /** |
|
22 | + * Returns the HTTP statuscode for this exception. |
|
23 | + * |
|
24 | + * @return int |
|
25 | + */ |
|
26 | + public function getHTTPCode() |
|
27 | + { |
|
28 | + return 400; |
|
29 | + } |
|
30 | 30 | } |
@@ -17,52 +17,52 @@ |
||
17 | 17 | */ |
18 | 18 | class Locked extends DAV\Exception |
19 | 19 | { |
20 | - /** |
|
21 | - * Lock information. |
|
22 | - * |
|
23 | - * @var \Sabre\DAV\Locks\LockInfo |
|
24 | - */ |
|
25 | - protected $lock; |
|
20 | + /** |
|
21 | + * Lock information. |
|
22 | + * |
|
23 | + * @var \Sabre\DAV\Locks\LockInfo |
|
24 | + */ |
|
25 | + protected $lock; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Creates the exception. |
|
29 | - * |
|
30 | - * A LockInfo object should be passed if the user should be informed |
|
31 | - * which lock actually has the file locked. |
|
32 | - * |
|
33 | - * @param DAV\Locks\LockInfo $lock |
|
34 | - */ |
|
35 | - public function __construct(DAV\Locks\LockInfo $lock = null) |
|
36 | - { |
|
37 | - parent::__construct(); |
|
27 | + /** |
|
28 | + * Creates the exception. |
|
29 | + * |
|
30 | + * A LockInfo object should be passed if the user should be informed |
|
31 | + * which lock actually has the file locked. |
|
32 | + * |
|
33 | + * @param DAV\Locks\LockInfo $lock |
|
34 | + */ |
|
35 | + public function __construct(DAV\Locks\LockInfo $lock = null) |
|
36 | + { |
|
37 | + parent::__construct(); |
|
38 | 38 | |
39 | - $this->lock = $lock; |
|
40 | - } |
|
39 | + $this->lock = $lock; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Returns the HTTP statuscode for this exception. |
|
44 | - * |
|
45 | - * @return int |
|
46 | - */ |
|
47 | - public function getHTTPCode() |
|
48 | - { |
|
49 | - return 423; |
|
50 | - } |
|
42 | + /** |
|
43 | + * Returns the HTTP statuscode for this exception. |
|
44 | + * |
|
45 | + * @return int |
|
46 | + */ |
|
47 | + public function getHTTPCode() |
|
48 | + { |
|
49 | + return 423; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * This method allows the exception to include additional information into the WebDAV error response. |
|
54 | - */ |
|
55 | - public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
56 | - { |
|
57 | - if ($this->lock) { |
|
58 | - $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:lock-token-submitted'); |
|
59 | - $errorNode->appendChild($error); |
|
52 | + /** |
|
53 | + * This method allows the exception to include additional information into the WebDAV error response. |
|
54 | + */ |
|
55 | + public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
56 | + { |
|
57 | + if ($this->lock) { |
|
58 | + $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:lock-token-submitted'); |
|
59 | + $errorNode->appendChild($error); |
|
60 | 60 | |
61 | - $href = $errorNode->ownerDocument->createElementNS('DAV:', 'd:href'); |
|
62 | - $href->appendChild($errorNode->ownerDocument->createTextNode($this->lock->uri)); |
|
63 | - $error->appendChild( |
|
64 | - $href |
|
65 | - ); |
|
66 | - } |
|
67 | - } |
|
61 | + $href = $errorNode->ownerDocument->createElementNS('DAV:', 'd:href'); |
|
62 | + $href->appendChild($errorNode->ownerDocument->createTextNode($this->lock->uri)); |
|
63 | + $error->appendChild( |
|
64 | + $href |
|
65 | + ); |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |