1<?php
2
3namespace Sabre\DAV\Exception;
4
5use Sabre\DAV;
6
7/**
8 * ConflictingLock
9 *
10 * Similar to  the Locked exception, this exception thrown when a LOCK request
11 * was made, on a resource which was already locked
12 *
13 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
14 * @author Evert Pot (http://evertpot.com/)
15 * @license http://sabre.io/license/ Modified BSD License
16 */
17class ConflictingLock extends Locked {
18
19    /**
20     * This method allows the exception to include additional information into the WebDAV error response
21     *
22     * @param DAV\Server $server
23     * @param \DOMElement $errorNode
24     * @return void
25     */
26    function serialize(DAV\Server $server, \DOMElement $errorNode) {
27
28        if ($this->lock) {
29            $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:no-conflicting-lock');
30            $errorNode->appendChild($error);
31            $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:href', $this->lock->uri));
32        }
33
34    }
35
36}
37