| @@ 5-24 (lines=20) @@ | ||
| 2 | ||
| 3 | namespace CultuurNet\UDB3\SavedSearches\Properties; |
|
| 4 | ||
| 5 | class CreatedByQueryString extends QueryString |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @param string[] $queryParts |
|
| 9 | */ |
|
| 10 | public function __construct(string ...$queryParts) |
|
| 11 | { |
|
| 12 | if (empty($queryParts)) { |
|
| 13 | throw new \InvalidArgumentException('At least one query part is required.'); |
|
| 14 | } |
|
| 15 | ||
| 16 | $query = implode(' OR ', $queryParts); |
|
| 17 | if (count($queryParts) > 1) { |
|
| 18 | $query = '(' . $query . ')'; |
|
| 19 | } |
|
| 20 | $query = 'createdby:' . $query; |
|
| 21 | ||
| 22 | parent::__construct($query); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| @@ 5-24 (lines=20) @@ | ||
| 2 | ||
| 3 | namespace CultuurNet\UDB3\SavedSearches\Properties; |
|
| 4 | ||
| 5 | class CreatorQueryString extends QueryString |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @param string[] $queryParts |
|
| 9 | */ |
|
| 10 | public function __construct(string ...$queryParts) |
|
| 11 | { |
|
| 12 | if (empty($queryParts)) { |
|
| 13 | throw new \InvalidArgumentException('At least one query part is required.'); |
|
| 14 | } |
|
| 15 | ||
| 16 | $query = implode(' OR ', $queryParts); |
|
| 17 | if (count($queryParts) > 1) { |
|
| 18 | $query = '(' . $query . ')'; |
|
| 19 | } |
|
| 20 | $query = 'creator:' . $query; |
|
| 21 | ||
| 22 | parent::__construct($query); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||