| @@ 85-91 (lines=7) @@ | ||
| 82 | } |
|
| 83 | ||
| 84 | switch ($key) { |
|
| 85 | case self::MATCH_DEPTH: |
|
| 86 | $match = reset($values); |
|
| 87 | $operator = key($values); |
|
| 88 | if (!isset(self::$operatorsMap[$operator])) { |
|
| 89 | throw new \Exception("Can not use '$operator' as comparison operator for depth"); |
|
| 90 | } |
|
| 91 | return new Query\Criterion\Location\Depth(self::$operatorsMap[$operator], $match); |
|
| 92 | ||
| 93 | case self::MATCH_IS_MAIN_LOCATION: |
|
| 94 | /// @todo error/warning if there is more than 1 value... |
|
| @@ 102-108 (lines=7) @@ | ||
| 99 | return new Query\Criterion\Location\IsMainLocation(Query\Criterion\Location\IsMainLocation::NOT_MAIN); |
|
| 100 | } |
|
| 101 | ||
| 102 | case self::MATCH_PRIORITY: |
|
| 103 | $match = reset($values); |
|
| 104 | $operator = key($values); |
|
| 105 | if (!isset(self::$operatorsMap[$operator])) { |
|
| 106 | throw new \Exception("Can not use '$operator' as comparison operator for depth"); |
|
| 107 | } |
|
| 108 | return new Query\Criterion\Location\Priority(self::$operatorsMap[$operator], $match); |
|
| 109 | } |
|
| 110 | ||
| 111 | return parent::getQueryCriterion($key, $values); |
|
| @@ 122-128 (lines=7) @@ | ||
| 119 | case self::MATCH_CONTENT_TYPE_IDENTIFIER: |
|
| 120 | return new Query\Criterion\ContentTypeIdentifier($values); |
|
| 121 | ||
| 122 | case self::MATCH_CREATION_DATE: |
|
| 123 | $match = reset($values); |
|
| 124 | $operator = key($values); |
|
| 125 | if (!isset(self::$operatorsMap[$operator])) { |
|
| 126 | throw new \Exception("Can not use '$operator' as comparison operator for dates"); |
|
| 127 | } |
|
| 128 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::CREATED, self::$operatorsMap[$operator], $match); |
|
| 129 | ||
| 130 | case self::MATCH_GROUP: |
|
| 131 | foreach($values as &$value) { |
|
| @@ 138-144 (lines=7) @@ | ||
| 135 | } |
|
| 136 | return new Query\Criterion\UserMetadata(Query\Criterion\UserMetadata::GROUP, Operator::IN, $values); |
|
| 137 | ||
| 138 | case self::MATCH_MODIFICATION_DATE: |
|
| 139 | $match = reset($values); |
|
| 140 | $operator = key($values); |
|
| 141 | if (!isset(self::$operatorsMap[$operator])) { |
|
| 142 | throw new \Exception("Can not use '$operator' as comparison operator for dates"); |
|
| 143 | } |
|
| 144 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::MODIFIED, self::$operatorsMap[$operator], $match); |
|
| 145 | ||
| 146 | case self::MATCH_OBJECT_STATE: |
|
| 147 | foreach($values as &$value) { |
|