Completed
Pull Request — master (#395)
by Luc
13:59
created

CreatedByQueryString::generateQuery()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 3
nc 3
nop 0
1
<?php
2
3
namespace CultuurNet\UDB3\SavedSearches\Properties;
4
5
class CreatedByQueryString extends QueryString
6
{
7
    /**
8
     * @param array $queryParts
9
     */
10
    public function __construct(array $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