mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 17:44:06 +02:00
psalm fixes
This commit is contained in:
parent
1290acf675
commit
3d85afde98
6 changed files with 19 additions and 15 deletions
|
|
@ -76,11 +76,11 @@ class SearchPlugin extends ServerPlugin {
|
|||
/**
|
||||
* SEARCH is allowed for users files
|
||||
*
|
||||
* @param string $uri
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
public function getHTTPMethods($uri) {
|
||||
$path = $this->pathHelper->getPathFromUri($uri);
|
||||
public function getHTTPMethods($path) {
|
||||
$path = $this->pathHelper->getPathFromUri($path);
|
||||
if ($this->searchBackend->getArbiterPath() === $path) {
|
||||
return ['SEARCH'];
|
||||
} else {
|
||||
|
|
@ -95,9 +95,9 @@ class SearchPlugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
public function searchHandler(RequestInterface $request, ResponseInterface $response) {
|
||||
$contentType = $request->getHeader('Content-Type');
|
||||
$contentType = $request->getHeader('Content-Type') ?? '';
|
||||
|
||||
// Currently we only support xml search queries
|
||||
// Currently, we only support xml search queries
|
||||
if ((strpos($contentType, 'text/xml') === false) && (strpos($contentType, 'application/xml') === false)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,14 +41,15 @@ class Operator {
|
|||
* The type of operation, one of the Operator::OPERATION_* constants
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var (Literal|SearchPropDefinition|Operation)[]
|
||||
* @var (Literal|\SearchDAV\Backend\SearchPropertyDefinition|Operator)[]
|
||||
*
|
||||
* The list of arguments for the operation
|
||||
*
|
||||
* - SearchPropDefinition: property for comparison
|
||||
* - Literal: literal value for comparison
|
||||
* - Operation: nested operation for and/or/not operations
|
||||
* - Operator: nested operation for and/or/not operations
|
||||
*
|
||||
* Which type and what number of argument an Operator takes depends on the operator type.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Query {
|
|||
*/
|
||||
public $from;
|
||||
/**
|
||||
* @var Operator
|
||||
* @var ?Operator
|
||||
*
|
||||
* The search operator, either a comparison ('gt', 'eq', ...) or a boolean operator ('and', 'or', 'not')
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class BasicSearch implements XmlDeserializable {
|
|||
*/
|
||||
public $from;
|
||||
/**
|
||||
* @var Operator
|
||||
* @var ?Operator
|
||||
*
|
||||
* The search operator, either a comparison ('gt', 'eq', ...) or a boolean operator ('and', 'or', 'not')
|
||||
*/
|
||||
|
|
@ -79,11 +79,11 @@ class BasicSearch implements XmlDeserializable {
|
|||
throw new ParseException('Missing {DAV:}from when parsing {DAV:}basicsearch');
|
||||
}
|
||||
|
||||
$search->select = isset($elements['{DAV:}select']) ? $elements['{DAV:}select'] : [];
|
||||
$search->select = $elements['{DAV:}select'] ?? [];
|
||||
$search->from = $elements['{DAV:}from'];
|
||||
$search->where = isset($elements['{DAV:}where']) ? $elements['{DAV:}where'] : null;
|
||||
$search->orderBy = isset($elements['{DAV:}orderby']) ? $elements['{DAV:}orderby'] : [];
|
||||
$search->limit = isset($elements['{DAV:}limit']) ? $elements['{DAV:}limit'] : new Limit();
|
||||
$search->where = $elements['{DAV:}where'] ?? null;
|
||||
$search->orderBy = $elements['{DAV:}orderby'] ?? [];
|
||||
$search->limit = $elements['{DAV:}limit'] ?? new Limit();
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Operator implements XmlDeserializable {
|
|||
*/
|
||||
public $type;
|
||||
/**
|
||||
* @var (Literal|string|Operation)[]
|
||||
* @var (Literal|string|Operator)[]
|
||||
*
|
||||
* The list of arguments for the operation
|
||||
*
|
||||
|
|
@ -59,7 +59,7 @@ class Operator implements XmlDeserializable {
|
|||
static function xmlDeserialize(Reader $reader): Operator {
|
||||
$operator = new self();
|
||||
|
||||
$operator->type = $reader->getClark();
|
||||
$operator->type = $reader->getClark() ?? '';
|
||||
if ($reader->isEmptyElement) {
|
||||
$reader->next();
|
||||
return $operator;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ class QueryDiscoverResponse extends Response {
|
|||
* @param null|int|string $httpStatus
|
||||
*/
|
||||
function __construct($href, BasicSearchSchema $schema = null, $httpStatus = null) {
|
||||
if ($httpStatus !== null) {
|
||||
$httpStatus = (string)$httpStatus;
|
||||
}
|
||||
parent::__construct($href, [], $httpStatus);
|
||||
$this->schema = $schema;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue