1<?php
2
3declare(strict_types=1);
4
5namespace Sabre\DAV;
6
7/**
8 * By implementing this interface, a collection can effectively say "other
9 * nodes may be moved into this collection".
10 *
11 * The benefit of this, is that sabre/dav will by default perform a move, by
12 * transferring an entire directory tree, copying every collection, and deleting
13 * every item.
14 *
15 * If a backend supports a better optimized move operation, this can trigger
16 * some huge speed gains.
17 *
18 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
19 * @author Evert Pot (http://evertpot.com/)
20 * @license http://sabre.io/license/ Modified BSD License
21 */
22interface IMoveTarget extends ICollection
23{
24    /**
25     * Moves a node into this collection.
26     *
27     * It is up to the implementors to:
28     *   1. Create the new resource.
29     *   2. Remove the old resource.
30     *   3. Transfer any properties or other data.
31     *
32     * Generally you should make very sure that your collection can easily move
33     * the move.
34     *
35     * If you don't, just return false, which will trigger sabre/dav to handle
36     * the move itself. If you return true from this function, the assumption
37     * is that the move was successful.
38     *
39     * @param string $targetName new local file/collection name
40     * @param string $sourcePath Full path to source node
41     * @param INode  $sourceNode Source node itself
42     *
43     * @return bool
44     */
45    public function moveInto($targetName, $sourcePath, INode $sourceNode);
46}
47