52 '{DAV:}getlastmodified',
53 '{DAV:}getcontentlength',
55 '{DAV:}quota-used-bytes',
56 '{DAV:}quota-available-bytes',
58 '{DAV:}getcontenttype',
62 foreach ($this->properties as $propertyName) {
65 $this->result[$propertyName] = [404, null];
68 $this->itemsLeft = count($this->result);
94 function handle($propertyName, $valueOrCallBack) {
96 if ($this->itemsLeft && isset($this->result[$propertyName]) && $this->result[$propertyName][0] === 404) {
97 if (is_callable($valueOrCallBack)) {
98 $value = $valueOrCallBack();
100 $value = $valueOrCallBack;
102 if (!is_null($value)) {
104 $this->result[$propertyName] = [200, $value];
121 function set($propertyName, $value, $status = null) {
123 if (is_null($status)) {
124 $status = is_null($value) ? 404 : 200;
128 if (!isset($this->result[$propertyName])) {
129 if ($this->requestType === self::ALLPROPS) {
130 $this->result[$propertyName] = [$status, $value];
134 if ($status !== 404 && $this->result[$propertyName][0] === 404) {
136 } elseif ($status === 404 && $this->result[$propertyName][0] !== 404) {
139 $this->result[$propertyName] = [$status, $value];
149 function get($propertyName) {
151 return isset($this->result[$propertyName]) ? $this->result[$propertyName][1] : null;
166 return isset($this->result[$propertyName]) ? $this->result[$propertyName][0] : null;
224 if ($this->itemsLeft === 0) {
228 foreach ($this->result as $propertyName => $stuff) {
229 if ($stuff[0] === 404) {
257 return $this->requestType === self::ALLPROPS;
279 foreach ($this->result as $propertyName =>
$info) {
281 $r[$info[0]] = [$propertyName => $info[1]];
283 $r[$info[0]][$propertyName] = $info[1];
287 if ($this->requestType === self::ALLPROPS) unset(
$r[404]);
handle($propertyName, $valueOrCallBack)
Handles a specific property.
getPath()
Returns the path this PROPFIND request is for.
const PROPNAME
A propname request.
getDepth()
Returns the depth of this propfind request.
$requestType
The type of request.
This class holds all the information about a PROPFIND request.
get404Properties()
Returns all propertynames that have a 404 status, and thus don't have a value yet.
getStatus($propertyName)
Returns the current status code for a property name.
setDepth($depth)
Updates the depth of this propfind request.
__construct($path, array $properties, $depth=0, $requestType=self::NORMAL)
Creates the PROPFIND object.
setPath($path)
Updates the path for this PROPFIND.
getRequestedProperties()
Returns the full list of requested properties.
isAllProps()
Returns true if this was an '{DAV:}allprops' request.
const ALLPROPS
An allprops request.
getResultForMultiStatus()
Returns a result array that's often used in multistatus responses.
const NORMAL
A normal propfind.