| Total Complexity | 6 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 24 | final class Optimize implements Command |
||
| 25 | { |
||
| 26 | use JsonHelper; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @psalm-var array{maxSegments: ?int, waitSearcher: ?bool} |
||
| 30 | */ |
||
| 31 | private array $options = [ |
||
| 32 | 'waitSearcher' => null, |
||
| 33 | 'maxSegments' => null, |
||
| 34 | ]; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @psalm-pure |
||
| 38 | */ |
||
| 39 | public static function create(): self |
||
| 40 | { |
||
| 41 | return new self(); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function enableWaitSearcher(): self |
||
| 45 | { |
||
| 46 | $commit = clone $this; |
||
| 47 | $commit->options['waitSearcher'] = true; |
||
| 48 | |||
| 49 | return $commit; |
||
| 50 | } |
||
| 51 | |||
| 52 | public function disableWaitSearcher(): self |
||
| 53 | { |
||
| 54 | $commit = clone $this; |
||
| 55 | $commit->options['waitSearcher'] = false; |
||
| 56 | |||
| 57 | return $commit; |
||
| 58 | } |
||
| 59 | |||
| 60 | public function maxSegments(int $maxSegments): self |
||
| 66 | } |
||
| 67 | |||
| 68 | public function toJson(): string |
||
| 71 | } |
||
| 72 | |||
| 73 | public function getName(): string |
||
| 78 |