Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| SearchMode | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
6 | |
100.00% |
1 / 1 |
| label | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Search\Domain\Model; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Search Execution Mode Enum. |
| 13 | * |
| 14 | * Defines query parsing and matching strategies for global search operations. |
| 15 | * |
| 16 | * @package App\Core\Search\Domain\Model |
| 17 | */ |
| 18 | enum SearchMode: string |
| 19 | { |
| 20 | case SMART = 'smart'; |
| 21 | case WORDS_AND = 'words_and'; |
| 22 | case WORDS_OR = 'words_or'; |
| 23 | case EXACT_PHRASE = 'exact_phrase'; |
| 24 | case PARTIAL = 'partial'; |
| 25 | |
| 26 | /** |
| 27 | * Returns human-readable label. |
| 28 | * |
| 29 | * @return string Mode display label. |
| 30 | */ |
| 31 | public function label(): string |
| 32 | { |
| 33 | return match ($this) { |
| 34 | self::SMART => 'Smart (Advanced)', |
| 35 | self::WORDS_AND => 'All words (AND)', |
| 36 | self::WORDS_OR => 'Any word (OR)', |
| 37 | self::EXACT_PHRASE => 'Exact phrase ("...")', |
| 38 | self::PARTIAL => 'Partial word (Prefix/Wildcard)', |
| 39 | }; |
| 40 | } |
| 41 | } |