Пример #1
0
    /**
     * Generates a WebDAV propfind response body based on a list of nodes.
     *
     * If 'strip404s' is set to true, all 404 responses will be removed.
     *
     * @param array $fileProperties The list with nodes
     * @param bool strip404s
     * @return string
     */
    function generateMultiStatus(array $fileProperties, $strip404s = false) {

        $xml = [];

        foreach ($fileProperties as $entry) {

            $href = $entry['href'];
            unset($entry['href']);
            if ($strip404s) {
                unset($entry[404]);
            }
            $response = new Xml\Element\Response(
                ltrim($href, '/'),
                $entry
            );
            $xml[] = [
                'name'  => '{DAV:}response',
                'value' => $response
            ];

        }
        return $this->xml->write('{DAV:}multistatus', $xml, $this->baseUri);

    }