ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\Browser\PropFindAll Class Reference

This class is used by the browser plugin to trick the system in returning every defined property. More...

+ Inheritance diagram for Sabre\DAV\Browser\PropFindAll:
+ Collaboration diagram for Sabre\DAV\Browser\PropFindAll:

Public Member Functions

 __construct ($path)
 Creates the PROPFIND object. More...
 
 handle ($propertyName, $valueOrCallBack)
 Handles a specific property. More...
 
 set ($propertyName, $value, $status=null)
 Sets the value of the property. More...
 
 get ($propertyName)
 Returns the current value for a property. More...
 
 getStatus ($propertyName)
 Returns the current status code for a property name. More...
 
 get404Properties ()
 Returns all propertynames that have a 404 status, and thus don't have a value yet. More...
 
- Public Member Functions inherited from Sabre\DAV\PropFind
 __construct ($path, array $properties, $depth=0, $requestType=self::NORMAL)
 Creates the PROPFIND object. More...
 
 handle ($propertyName, $valueOrCallBack)
 Handles a specific property. More...
 
 set ($propertyName, $value, $status=null)
 Sets the value of the property. More...
 
 get ($propertyName)
 Returns the current value for a property. More...
 
 getStatus ($propertyName)
 Returns the current status code for a property name. More...
 
 setPath ($path)
 Updates the path for this PROPFIND. More...
 
 getPath ()
 Returns the path this PROPFIND request is for. More...
 
 getDepth ()
 Returns the depth of this propfind request. More...
 
 setDepth ($depth)
 Updates the depth of this propfind request. More...
 
 get404Properties ()
 Returns all propertynames that have a 404 status, and thus don't have a value yet. More...
 
 getRequestedProperties ()
 Returns the full list of requested properties. More...
 
 isAllProps ()
 Returns true if this was an '{DAV:}allprops' request. More...
 
 getResultForMultiStatus ()
 Returns a result array that's often used in multistatus responses. More...
 

Additional Inherited Members

- Data Fields inherited from Sabre\DAV\PropFind
const NORMAL = 0
 A normal propfind. More...
 
const ALLPROPS = 1
 An allprops request. More...
 
const PROPNAME = 2
 A propname request. More...
 
- Protected Attributes inherited from Sabre\DAV\PropFind
 $path
 
 $depth = 0
 
 $requestType
 The type of request. More...
 
 $properties = []
 
 $result = []
 
 $itemsLeft
 

Detailed Description

This class is used by the browser plugin to trick the system in returning every defined property.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 15 of file PropFindAll.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAV\Browser\PropFindAll::__construct (   $path)

Creates the PROPFIND object.

Parameters
string$path

Definition at line 22 of file PropFindAll.php.

References Sabre\DAV\PropFind\$path.

22  {
23 
24  parent::__construct($path, []);
25 
26  }

Member Function Documentation

◆ get()

Sabre\DAV\Browser\PropFindAll::get (   $propertyName)

Returns the current value for a property.

Parameters
string$propertyName
Returns
mixed

Definition at line 89 of file PropFindAll.php.

89  {
90 
91  return isset($this->result[$propertyName]) ? $this->result[$propertyName][1] : null;
92 
93  }

◆ get404Properties()

Sabre\DAV\Browser\PropFindAll::get404Properties ( )

Returns all propertynames that have a 404 status, and thus don't have a value yet.

Returns
array

Definition at line 116 of file PropFindAll.php.

References Sabre\DAV\PropFind\$result.

116  {
117 
118  $result = [];
119  foreach ($this->result as $propertyName => $stuff) {
120  if ($stuff[0] === 404) {
121  $result[] = $propertyName;
122  }
123  }
124  // If there's nothing in this list, we're adding one fictional item.
125  if (!$result) {
126  $result[] = '{http://sabredav.org/ns}idk';
127  }
128  return $result;
129 
130  }

◆ getStatus()

Sabre\DAV\Browser\PropFindAll::getStatus (   $propertyName)

Returns the current status code for a property name.

If the property does not appear in the list of requested properties, null will be returned.

Parameters
string$propertyName
Returns
int|null

Definition at line 104 of file PropFindAll.php.

104  {
105 
106  return isset($this->result[$propertyName]) ? $this->result[$propertyName][0] : 404;
107 
108  }

◆ handle()

Sabre\DAV\Browser\PropFindAll::handle (   $propertyName,
  $valueOrCallBack 
)

Handles a specific property.

This method checks whether the specified property was requested in this PROPFIND request, and if so, it will call the callback and use the return value for it's value.

Example:

$propFind->handle('{DAV:}displayname', function() { return 'hello'; });

Note that handle will only work the first time. If null is returned, the value is ignored.

It's also possible to not pass a callback, but immediately pass a value

Parameters
string$propertyName
mixed$valueOrCallBack
Returns
void

Definition at line 50 of file PropFindAll.php.

50  {
51 
52  if (is_callable($valueOrCallBack)) {
53  $value = $valueOrCallBack();
54  } else {
55  $value = $valueOrCallBack;
56  }
57  if (!is_null($value)) {
58  $this->result[$propertyName] = [200, $value];
59  }
60 
61  }

◆ set()

Sabre\DAV\Browser\PropFindAll::set (   $propertyName,
  $value,
  $status = null 
)

Sets the value of the property.

If status is not supplied, the status will default to 200 for non-null properties, and 404 for null properties.

Parameters
string$propertyName
mixed$value
int$status
Returns
void

Definition at line 74 of file PropFindAll.php.

74  {
75 
76  if (is_null($status)) {
77  $status = is_null($value) ? 404 : 200;
78  }
79  $this->result[$propertyName] = [$status, $value];
80 
81  }

The documentation for this class was generated from the following file: