| Total Complexity | 5 |
| Total Lines | 88 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class WordTree |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * If implicit, the input text will be split into sentences and words, and displayed according to frequency. |
||
| 12 | * If explicit, words and their connections are specified directly. |
||
| 13 | * |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | protected $format; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * For implicit word trees, the regular expression to use to break the text into sentences. The sentences are then |
||
| 20 | * broken into words using the wordRegex option. |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $sentenceRegex; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Whether the word tree is a prefix tree (root word on the right), a suffix tree (left), or double tree (middle). |
||
| 28 | * |
||
| 29 | * @var string |
||
| 30 | */ |
||
| 31 | protected $type; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * For implicit word trees, which word to use as the root of the tree. (Note that word trees are case sensitive.) |
||
| 35 | * This option must be specified for double word trees. |
||
| 36 | * |
||
| 37 | * @var string |
||
| 38 | */ |
||
| 39 | protected $word; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * For implicit word trees, the regular expression to use to break sentences into individual words to be displayed. |
||
| 43 | * |
||
| 44 | * @var string |
||
| 45 | */ |
||
| 46 | protected $wordRegex; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return $this |
||
| 50 | */ |
||
| 51 | public function setFormat(string $format) |
||
| 52 | { |
||
| 53 | $this->format = $format; |
||
| 54 | |||
| 55 | return $this; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return $this |
||
| 60 | */ |
||
| 61 | public function setSentenceRegex(string $sentenceRegex) |
||
| 62 | { |
||
| 63 | $this->sentenceRegex = $sentenceRegex; |
||
| 64 | |||
| 65 | return $this; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @return $this |
||
| 70 | */ |
||
| 71 | public function setType(string $type) |
||
| 72 | { |
||
| 73 | $this->type = $type; |
||
| 74 | |||
| 75 | return $this; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @return $this |
||
| 80 | */ |
||
| 81 | public function setWord(string $word) |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @return $this |
||
| 90 | */ |
||
| 91 | public function setWordRegex(string $wordRegex) |
||
| 96 | } |
||
| 97 | } |
||
| 98 |