Lines 100.00% 3 / 3
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
CityNameFilter 100.00% 3 / 3 100.00% 2 / 2 3 100.00% 1 / 1
 __construct 100.00% 2 / 2 100.00% 1 / 1 2
 validate 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Districts\Editor\Domain\DistrictFilter;
6
7use InvalidArgumentException;
8
9readonly class CityNameFilter extends Filter
10{
11    public function __construct(
12        public string $cityName,
13    ) {
14        if (!self::validate($cityName)) {
15            throw new InvalidArgumentException();
16        }
17    }
18
19    private static function validate(string $cityName): bool
20    {
21        return $cityName !== "";
22    }
23}