1<?php
2
3declare(strict_types=1);
4
5namespace Sabre\DAV\Exception;
6
7use Sabre\DAV;
8
9/**
10 * ConflictingLock.
11 *
12 * Similar to  the Locked exception, this exception thrown when a LOCK request
13 * was made, on a resource which was already locked
14 *
15 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
16 * @author Evert Pot (http://evertpot.com/)
17 * @license http://sabre.io/license/ Modified BSD License
18 */
19class ConflictingLock extends Locked
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    }
32}
33