private function setupEntryFilter($entryFilter)
    {
        if ($entryFilter == null) {
            return null;
        }

        if (is_string($entryFilter)) {
            $filter = new Filter\StringFilter($entryFilter);
        } elseif ($entryFilter instanceof AbstractFilter) {
            $filter = $entryFilter;
        } else {
            throw new InvalidArgumentException(
                sprintf(
                    'baseEntryFilter argument must be either instance of %s or string. %s given',
                    AbstractFilter::class,
                    gettype($entryFilter)
                )
            );
        }

        return $filter;
    }