Total Complexity | 3 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class DictionaryEntryPos |
||
17 | { |
||
18 | const POS_UNDEFINED = ''; |
||
19 | const POS_NOUN = 'noun'; |
||
20 | const POS_PRONOUN = 'pronoun'; |
||
21 | const POS_VERB = 'verb'; |
||
22 | const POS_ADVERB = 'adverb'; |
||
23 | const POS_ADJECTIVE = 'adjective'; |
||
24 | const POS_CONJUCTION = 'conjuction'; |
||
25 | const POS_PREPOSITION = 'preposition'; |
||
26 | const POS_INTERJECTION = 'interjection'; |
||
27 | |||
28 | /** |
||
29 | * Stored part of speech |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private $pos = self::POS_UNDEFINED; |
||
34 | |||
35 | use GetConstantsTrait; |
||
36 | |||
37 | /** |
||
38 | * DictionaryEntryPos constructor |
||
39 | * |
||
40 | * @param string $pos |
||
41 | */ |
||
42 | public function __construct(string $pos = self::POS_UNDEFINED) |
||
43 | { |
||
44 | $pos = strtolower($pos); |
||
45 | |||
46 | if ($this->constantValueExists($pos)) { |
||
47 | $this->pos = $pos; |
||
48 | } else { |
||
49 | $this->pos = self::POS_UNDEFINED; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Returns part of speech as string |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getPos(): string |
||
61 | } |
||
62 | } |
||
63 |