1<?php
2
3namespace Sabre\DAV;
4
5/**
6 * The ICollection Interface
7 *
8 * This interface should be implemented by each class that represents a collection
9 *
10 * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
11 * @author Evert Pot (http://evertpot.com/)
12 * @license http://sabre.io/license/ Modified BSD License
13 */
14interface ICollection extends INode {
15
16    /**
17     * Creates a new file in the directory
18     *
19     * Data will either be supplied as a stream resource, or in certain cases
20     * as a string. Keep in mind that you may have to support either.
21     *
22     * After successful creation of the file, you may choose to return the ETag
23     * of the new file here.
24     *
25     * The returned ETag must be surrounded by double-quotes (The quotes should
26     * be part of the actual string).
27     *
28     * If you cannot accurately determine the ETag, you should not return it.
29     * If you don't store the file exactly as-is (you're transforming it
30     * somehow) you should also not return an ETag.
31     *
32     * This means that if a subsequent GET to this new file does not exactly
33     * return the same contents of what was submitted here, you are strongly
34     * recommended to omit the ETag.
35     *
36     * @param string $name Name of the file
37     * @param resource|string $data Initial payload
38     * @return null|string
39     */
40    function createFile($name, $data = null);
41
42    /**
43     * Creates a new subdirectory
44     *
45     * @param string $name
46     * @return void
47     */
48    function createDirectory($name);
49
50    /**
51     * Returns a specific child node, referenced by its name
52     *
53     * This method must throw Sabre\DAV\Exception\NotFound if the node does not
54     * exist.
55     *
56     * @param string $name
57     * @return DAV\INode
58     */
59    function getChild($name);
60
61    /**
62     * Returns an array with all the child nodes
63     *
64     * @return DAV\INode[]
65     */
66    function getChildren();
67
68    /**
69     * Checks if a child-node with the specified name exists
70     *
71     * @param string $name
72     * @return bool
73     */
74    function childExists($name);
75
76}
77