diff options
Diffstat (limited to 'vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php')
-rw-r--r-- | vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php index d7799429d..a22a577c9 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Filter; use Sabre\CardDAV\Plugin; @@ -21,8 +23,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class PropFilter implements XmlDeserializable { - +class PropFilter implements XmlDeserializable +{ /** * The deserialize method is called during xml parsing. * @@ -42,57 +44,54 @@ class PropFilter implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $result = [ - 'name' => null, - 'test' => 'anyof', + 'name' => null, + 'test' => 'anyof', 'is-not-defined' => false, - 'param-filters' => [], - 'text-matches' => [], + 'param-filters' => [], + 'text-matches' => [], ]; $att = $reader->parseAttributes(); $result['name'] = $att['name']; - if (isset($att['test']) && $att['test'] === 'allof') { + if (isset($att['test']) && 'allof' === $att['test']) { $result['test'] = 'allof'; } $elems = $reader->parseInnerTree(); - if (is_array($elems)) foreach ($elems as $elem) { - - switch ($elem['name']) { - - case '{' . Plugin::NS_CARDDAV . '}param-filter' : + if (is_array($elems)) { + foreach ($elems as $elem) { + switch ($elem['name']) { + case '{'.Plugin::NS_CARDDAV.'}param-filter': $result['param-filters'][] = $elem['value']; break; - case '{' . Plugin::NS_CARDDAV . '}is-not-defined' : + case '{'.Plugin::NS_CARDDAV.'}is-not-defined': $result['is-not-defined'] = true; break; - case '{' . Plugin::NS_CARDDAV . '}text-match' : + case '{'.Plugin::NS_CARDDAV.'}text-match': $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { - throw new BadRequest('Unknown match-type: ' . $matchType); + throw new BadRequest('Unknown match-type: '.$matchType); } $result['text-matches'][] = [ - 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes', - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', - 'value' => $elem['value'], - 'match-type' => $matchType, + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', + 'value' => $elem['value'], + 'match-type' => $matchType, ]; break; - } - + } } return $result; - } - } |