mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 17:44:06 +02:00
Seperate query classes from xml classes to allow specifying more information in the query
This commit is contained in:
parent
82bcf2cebb
commit
5ad4d24b89
17 changed files with 509 additions and 112 deletions
|
|
@ -21,9 +21,7 @@
|
|||
|
||||
namespace SearchDAV\Backend;
|
||||
|
||||
use Sabre\DAV\INode;
|
||||
use SearchDAV\XML\BasicSearch;
|
||||
use SearchDAV\XML\Scope;
|
||||
use SearchDAV\Query\Query;
|
||||
|
||||
interface ISearchBackend {
|
||||
/**
|
||||
|
|
@ -79,8 +77,8 @@ interface ISearchBackend {
|
|||
* To return the properties requested by the query sabre's existing PropFind method is used, thus the search implementation
|
||||
* is not required to collect these properties and is free to ignore the `select` part of the query
|
||||
*
|
||||
* @param BasicSearch $query
|
||||
* @param Query $query
|
||||
* @return SearchResult[]
|
||||
*/
|
||||
public function search(BasicSearch $query);
|
||||
public function search(Query $query);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,16 @@
|
|||
|
||||
namespace SearchDAV\DAV;
|
||||
|
||||
use Sabre\DAV\Exception\BadRequest;
|
||||
use Sabre\DAV\PropFind;
|
||||
use Sabre\DAV\Server;
|
||||
use Sabre\HTTP\ResponseInterface;
|
||||
use SearchDAV\Backend\ISearchBackend;
|
||||
use SearchDAV\Backend\SearchPropertyDefinition;
|
||||
use SearchDAV\Backend\SearchResult;
|
||||
use SearchDAV\Query\Operator;
|
||||
use SearchDAV\Query\Order;
|
||||
use SearchDAV\Query\Query;
|
||||
use SearchDAV\XML\BasicSearch;
|
||||
|
||||
class SearchHandler {
|
||||
|
|
@ -69,15 +74,79 @@ class SearchHandler {
|
|||
}
|
||||
$response->setStatus(207);
|
||||
$response->setHeader('Content-Type', 'application/xml; charset="utf-8"');
|
||||
$allProps = [];
|
||||
foreach ($query->from as $scope) {
|
||||
$scope->path = $this->pathHelper->getPathFromUri($scope->href);
|
||||
$props = $this->searchBackend->getPropertyDefinitionsForScope($scope->href, $scope->path);
|
||||
foreach ($props as $prop) {
|
||||
$allProps[$prop->name] = $prop;
|
||||
}
|
||||
}
|
||||
try {
|
||||
$results = $this->searchBackend->search($this->getQueryForXML($query, $allProps));
|
||||
} catch (BadRequest $e) {
|
||||
$response->setStatus(400);
|
||||
$response->setBody($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
$results = $this->searchBackend->search($query);
|
||||
$data = $this->server->generateMultiStatus(iterator_to_array($this->getPropertiesIteratorResults($results, $query->select)), false);
|
||||
$response->setBody($data);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BasicSearch $xml
|
||||
* @param SearchPropertyDefinition[] $allProps
|
||||
* @return Query
|
||||
*/
|
||||
private function getQueryForXML(BasicSearch $xml, array $allProps) {
|
||||
$orderBy = array_map(function (\SearchDAV\XML\Order $order) use ($allProps) {
|
||||
if (!isset($allProps[$order->property])) {
|
||||
throw new BadRequest('requested order by property is not a valid property for this scope');
|
||||
}
|
||||
$prop = $allProps[$order->property];
|
||||
if (!$prop->sortable) {
|
||||
throw new BadRequest('requested order by property is not sortable');
|
||||
}
|
||||
return new Order($prop, $order->order);
|
||||
}, $xml->orderBy);
|
||||
$select = array_map(function ($propName) use ($allProps) {
|
||||
if (!isset($allProps[$propName])) {
|
||||
throw new BadRequest('requested property is not a valid property for this scope');
|
||||
}
|
||||
$prop = $allProps[$propName];
|
||||
if (!$prop->selectable) {
|
||||
throw new BadRequest('requested property is not selectable');
|
||||
}
|
||||
return $prop;
|
||||
}, $xml->select);
|
||||
|
||||
$where = $this->transformOperator($xml->where, $allProps);
|
||||
|
||||
return new Query($select, $xml->from, $where, $orderBy, $xml->limit);
|
||||
}
|
||||
|
||||
private function transformOperator(\SearchDAV\XML\Operator $operator, array $allProps) {
|
||||
$arguments = array_map(function ($argument) use ($allProps) {
|
||||
if (is_string($argument)) {
|
||||
if (!isset($allProps[$argument])) {
|
||||
throw new BadRequest('requested search property is not a valid property for this scope');
|
||||
}
|
||||
$prop = $allProps[$argument];
|
||||
if (!$prop->searchable) {
|
||||
throw new BadRequest('requested search property is not searchable');
|
||||
}
|
||||
return $prop;
|
||||
} else if ($argument instanceof \SearchDAV\XML\Operator) {
|
||||
return $this->transformOperator($argument, $allProps);
|
||||
} else {
|
||||
return $argument;
|
||||
}
|
||||
}, $operator->arguments);
|
||||
|
||||
return new Operator($operator->type, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of properties for a given path
|
||||
*
|
||||
|
|
|
|||
40
src/Query/Limit.php
Normal file
40
src/Query/Limit.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SearchDAV\Query;
|
||||
|
||||
|
||||
class Limit {
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* The maximum number of results to be returned
|
||||
*
|
||||
* If set to 0 then no limit should be imposed
|
||||
*/
|
||||
public $maxResults = 0;
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* The index of the first result to be returned (offset)
|
||||
*/
|
||||
public $firstResult = 0;
|
||||
}
|
||||
41
src/Query/Literal.php
Normal file
41
src/Query/Literal.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SearchDAV\Query;
|
||||
|
||||
|
||||
class Literal {
|
||||
/**
|
||||
* @var string|boolean|\DateTime|integer
|
||||
*
|
||||
* The value of the literal
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* Literal constructor.
|
||||
*
|
||||
* @param bool|\DateTime|int|string $value
|
||||
*/
|
||||
public function __construct($value = '') {
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
67
src/Query/Operator.php
Normal file
67
src/Query/Operator.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SearchDAV\Query;
|
||||
|
||||
class Operator {
|
||||
const OPERATION_AND = '{DAV:}and';
|
||||
const OPERATION_OR = '{DAV:}or';
|
||||
const OPERATION_NOT = '{DAV:}not';
|
||||
const OPERATION_EQUAL = '{DAV:}eq';
|
||||
const OPERATION_LESS_THAN = '{DAV:}lt';
|
||||
const OPERATION_LESS_OR_EQUAL_THAN = '{DAV:}lte';
|
||||
const OPERATION_GREATER_THAN = '{DAV:}gt';
|
||||
const OPERATION_GREATER_OR_EQUAL_THAN = '{DAV:}gte';
|
||||
const OPERATION_IS_COLLECTION = '{DAV:}is-collection';
|
||||
const OPERATION_IS_DEFINED = '{DAV:}is-defined';
|
||||
const OPERATION_IS_LIKE = '{DAV:}like';
|
||||
const OPERATION_CONTAINS = '{DAV:}contains';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* The type of operation, one of the Operator::OPERATION_* constants
|
||||
*/
|
||||
public $type;
|
||||
/**
|
||||
* @var (Literal|SearchPropDefinition|Operation)[]
|
||||
*
|
||||
* The list of arguments for the operation
|
||||
*
|
||||
* - SearchPropDefinition: property for comparison
|
||||
* - Literal: literal value for comparison
|
||||
* - Operation: nested operation for and/or/not operations
|
||||
*
|
||||
* Which type and what number of argument an Operator takes depends on the operator type.
|
||||
*/
|
||||
public $arguments;
|
||||
|
||||
/**
|
||||
* Operator constructor.
|
||||
*
|
||||
* @param string $type
|
||||
* @param array $arguments
|
||||
*/
|
||||
public function __construct($type = '', array $arguments = []) {
|
||||
$this->type = $type;
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
}
|
||||
53
src/Query/Order.php
Normal file
53
src/Query/Order.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SearchDAV\Query;
|
||||
|
||||
|
||||
use SearchDAV\Backend\SearchPropertyDefinition;
|
||||
|
||||
class Order {
|
||||
const ASC = 'ascending';
|
||||
const DESC = 'descending';
|
||||
|
||||
/**
|
||||
* @var SearchPropertyDefinition
|
||||
*
|
||||
* The property that should be sorted on.
|
||||
*/
|
||||
public $property;
|
||||
/**
|
||||
* @var string 'ascending' or 'descending'
|
||||
*
|
||||
* The sort direction
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* Order constructor.
|
||||
* @param SearchPropertyDefinition $property
|
||||
* @param string $order
|
||||
*/
|
||||
public function __construct(SearchPropertyDefinition $property, $order) {
|
||||
$this->property = $property;
|
||||
$this->order = $order;
|
||||
}
|
||||
}
|
||||
79
src/Query/Query.php
Normal file
79
src/Query/Query.php
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SearchDAV\Query;
|
||||
|
||||
|
||||
use SearchDAV\Backend\SearchPropertyDefinition;
|
||||
|
||||
class Query {
|
||||
/**
|
||||
* @var SearchPropertyDefinition[]
|
||||
*
|
||||
* The list of properties to be selected
|
||||
*/
|
||||
public $select;
|
||||
/**
|
||||
* @var Scope[]
|
||||
*
|
||||
* The collections to perform the search in
|
||||
*/
|
||||
public $from;
|
||||
/**
|
||||
* @var Operator
|
||||
*
|
||||
* The search operator, either a comparison ('gt', 'eq', ...) or a boolean operator ('and', 'or', 'not')
|
||||
*/
|
||||
public $where;
|
||||
/**
|
||||
* @var Order[]
|
||||
*
|
||||
* The list of order operations that should be used to order the results.
|
||||
*
|
||||
* Each order operations consists of a property to sort on and a sort direction.
|
||||
* If more then one order operations are specified, the comparisons for ordering should
|
||||
* be applied in the order that the order operations are defined in with the earlier comparisons being
|
||||
* more significant.
|
||||
*/
|
||||
public $orderBy;
|
||||
/**
|
||||
* @var Limit
|
||||
*
|
||||
* The limit and offset for the search query
|
||||
*/
|
||||
public $limit;
|
||||
|
||||
/**
|
||||
* Query constructor.
|
||||
* @param SearchPropertyDefinition[] $select
|
||||
* @param Scope[] $from
|
||||
* @param Operator $where
|
||||
* @param Order[] $orderBy
|
||||
* @param Limit $limit
|
||||
*/
|
||||
public function __construct(array $select, array $from, Operator $where, array $orderBy, Limit $limit) {
|
||||
$this->select = $select;
|
||||
$this->from = $from;
|
||||
$this->where = $where;
|
||||
$this->orderBy = $orderBy;
|
||||
$this->limit = $limit;
|
||||
}
|
||||
}
|
||||
60
src/Query/Scope.php
Normal file
60
src/Query/Scope.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SearchDAV\Query;
|
||||
|
||||
|
||||
class Scope {
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* The scope of the search, either as absolute uri or as a path relative to the
|
||||
* search arbiter.
|
||||
*/
|
||||
public $href;
|
||||
|
||||
/**
|
||||
* @var string|int 0, 1 or 'infinite'
|
||||
*
|
||||
* How deep the search query should be with 0 being only the scope itself,
|
||||
* 1 being all direct child entries of the scope and infinite being all entries
|
||||
* in the scope collection at any depth.
|
||||
*/
|
||||
public $depth;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* the path of the search scope relative to the dav server, or null if the scope is outside the dav server
|
||||
*/
|
||||
public $path;
|
||||
|
||||
/**
|
||||
* @param string $href
|
||||
* @param int|string $depth
|
||||
* @param string|null $path
|
||||
*/
|
||||
public function __construct($href = '', $depth = 1, $path = null) {
|
||||
$this->href = $href;
|
||||
$this->depth = $depth;
|
||||
$this->path = $path;
|
||||
}
|
||||
}
|
||||
|
|
@ -28,22 +28,7 @@ use SearchDAV\DAV\SearchPlugin;
|
|||
/**
|
||||
* The limit and offset of a search query
|
||||
*/
|
||||
class Limit implements XmlDeserializable {
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* The maximum number of results to be returned
|
||||
*
|
||||
* If set to 0 then no limit should be imposed
|
||||
*/
|
||||
public $maxResults = 0;
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* The index of the first result to be returned (offset)
|
||||
*/
|
||||
public $firstResult = 0;
|
||||
|
||||
class Limit extends \SearchDAV\Query\Limit implements XmlDeserializable {
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
$limit = new self();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,24 +25,7 @@ namespace SearchDAV\XML;
|
|||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
class Literal implements XmlDeserializable {
|
||||
/**
|
||||
* @var string|boolean|\DateTime|integer
|
||||
*
|
||||
* The value of the literal
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* Literal constructor.
|
||||
*
|
||||
* @param bool|\DateTime|int|string $value
|
||||
*/
|
||||
public function __construct($value = '') {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
|
||||
class Literal extends \SearchDAV\Query\Literal implements XmlDeserializable {
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
$literal = new self();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,28 +21,14 @@
|
|||
|
||||
namespace SearchDAV\XML;
|
||||
|
||||
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
class Operator implements XmlDeserializable {
|
||||
const OPERATION_AND = '{DAV:}and';
|
||||
const OPERATION_OR = '{DAV:}or';
|
||||
const OPERATION_NOT = '{DAV:}not';
|
||||
const OPERATION_EQUAL = '{DAV:}eq';
|
||||
const OPERATION_LESS_THAN = '{DAV:}lt';
|
||||
const OPERATION_LESS_OR_EQUAL_THAN = '{DAV:}lte';
|
||||
const OPERATION_GREATER_THAN = '{DAV:}gt';
|
||||
const OPERATION_GREATER_OR_EQUAL_THAN = '{DAV:}gte';
|
||||
const OPERATION_IS_COLLECTION = '{DAV:}is-collection';
|
||||
const OPERATION_IS_DEFINED = '{DAV:}is-defined';
|
||||
const OPERATION_IS_LIKE = '{DAV:}like';
|
||||
const OPERATION_CONTAINS = '{DAV:}contains';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* The type of operation, one of the Operation::OPERATION_* constants
|
||||
* The type of operation, one of the Operator::OPERATION_* constants
|
||||
*/
|
||||
public $type;
|
||||
/**
|
||||
|
|
@ -69,7 +55,6 @@ class Operator implements XmlDeserializable {
|
|||
$this->arguments = $arguments;
|
||||
}
|
||||
|
||||
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
$operator = new self();
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@ use Sabre\Xml\Reader;
|
|||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
class Order implements XmlDeserializable {
|
||||
const ASC = 'ascending';
|
||||
const DESC = 'descending';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
|
|
@ -48,7 +45,7 @@ class Order implements XmlDeserializable {
|
|||
* @param string $property
|
||||
* @param string $order
|
||||
*/
|
||||
public function __construct($property = '', $order = self::ASC) {
|
||||
public function __construct($property = '', $order = \SearchDAV\Query\Order::ASC) {
|
||||
$this->property = $property;
|
||||
$this->order = $order;
|
||||
}
|
||||
|
|
@ -58,7 +55,7 @@ class Order implements XmlDeserializable {
|
|||
|
||||
$childs = \Sabre\Xml\Deserializer\keyValue($reader);
|
||||
|
||||
$order->order = array_key_exists('{DAV:}descending', $childs) ? self::DESC : self::ASC;
|
||||
$order->order = array_key_exists('{DAV:}descending', $childs) ? \SearchDAV\Query\Order::DESC : \SearchDAV\Query\Order::ASC;
|
||||
$order->property = $childs['{DAV:}prop'][0];
|
||||
|
||||
return $order;
|
||||
|
|
|
|||
|
|
@ -21,46 +21,10 @@
|
|||
|
||||
namespace SearchDAV\XML;
|
||||
|
||||
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
class Scope implements XmlDeserializable {
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* The scope of the search, either as absolute uri or as a path relative to the
|
||||
* search arbiter.
|
||||
*/
|
||||
public $href;
|
||||
|
||||
/**
|
||||
* @var string|int 0, 1 or 'infinite'
|
||||
*
|
||||
* How deep the search query should be with 0 being only the scope itself,
|
||||
* 1 being all direct child entries of the scope and infinite being all entries
|
||||
* in the scope collection at any depth.
|
||||
*/
|
||||
public $depth;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* the path of the search scope relative to the dav server, or null if the scope is outside the dav server
|
||||
*/
|
||||
public $path;
|
||||
|
||||
/**
|
||||
* @param string $href
|
||||
* @param int|string $depth
|
||||
* @param string|null $path
|
||||
*/
|
||||
public function __construct($href = '', $depth = 1, $path = null) {
|
||||
$this->href = $href;
|
||||
$this->depth = $depth;
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
class Scope extends \SearchDAV\Query\Scope implements XmlDeserializable {
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
$scope = new self();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue