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