1 | <?php |
||
27 | class GlSpellCheckerError |
||
28 | { |
||
29 | /** |
||
30 | * @var array $suggs |
||
31 | */ |
||
32 | private $suggs; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $msg; |
||
38 | |||
39 | /** |
||
40 | * @var int |
||
41 | */ |
||
42 | private $length; |
||
43 | |||
44 | /** |
||
45 | * @var int |
||
46 | */ |
||
47 | private $offset; |
||
48 | |||
49 | /** |
||
50 | * @param string $msg |
||
51 | * @param int $offset |
||
52 | * @param int $length |
||
53 | * @param string $word |
||
54 | * @param array $suggs |
||
55 | */ |
||
56 | public function __construct($msg = '', $offset = null, $length = null, $word = '', $suggs = []) |
||
64 | |||
65 | /** |
||
66 | * @param GlSpellCheckerError $mergeerror |
||
67 | */ |
||
68 | public function merge(GlSpellCheckerError $mergeerror) { |
||
83 | |||
84 | /** |
||
85 | * @return array |
||
86 | */ |
||
87 | public function getSuggestions() |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getMessage() |
||
99 | |||
100 | /** |
||
101 | * @return int |
||
102 | */ |
||
103 | public function getOffset() |
||
107 | |||
108 | /** |
||
109 | * @return int |
||
110 | */ |
||
111 | public function getLength() |
||
115 | |||
116 | /** |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getWord() |
||
123 | } |
||
124 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: