| 1 | <?php |
||
| 22 | trait ArrayWordsTrait { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Words. |
||
| 26 | * |
||
| 27 | * @var Word[] |
||
| 28 | */ |
||
| 29 | private $words; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Add a word. |
||
| 33 | * |
||
| 34 | * @param Word $word The word. |
||
| 35 | * @return self Returns this instance. |
||
| 36 | */ |
||
| 37 | public function addWord(Word $word): self { |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the number of words. |
||
| 44 | * |
||
| 45 | * @return int Returns the number of words. |
||
| 46 | */ |
||
| 47 | public function getNumberWords(): int { |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Get the words. |
||
| 53 | * |
||
| 54 | * @return Word[] Returns the words. |
||
| 55 | */ |
||
| 56 | public function getWords(): array { |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Determines if this instance has words. |
||
| 62 | * |
||
| 63 | * @return bool Returns true in case of success, false otherwise. |
||
| 64 | */ |
||
| 65 | public function hasWords(): bool { |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Set the words. |
||
| 71 | * |
||
| 72 | * @param Word[] $words The words. |
||
| 73 | * @return self Returns this instance. |
||
| 74 | */ |
||
| 75 | protected function setWords(array $words): self { |
||
| 79 | } |