@@ -91,15 +91,16 @@ public function getCharacters(string $fields, array $where, bool $removeGMs = fa
91
91
*/
92
92
public function getOnlinePlayers (bool $ removeGMs = false ): false |array
93
93
{
94
- return $ this ->getCharacters (columns ("characters " , array ( "guid " , "account " , "name " , "race " , "class " , "gender " , "level " , "zone " ) , $ this ->realmId ), array ( column ("characters " , "online " , false , $ this ->realmId ) => 1 ) , $ removeGMs );
94
+ return $ this ->getCharacters (columns ("characters " , [ "guid " , "account " , "name " , "race " , "class " , "gender " , "level " , "zone " ] , $ this ->realmId ), [ column ("characters " , "online " , false , $ this ->realmId ) => 1 ] , $ removeGMs );
95
95
}
96
96
97
97
/**
98
98
* Get the online player count
99
99
*
100
+ * @param false|string $faction (alliance, horde)
100
101
* @return Int
101
102
*/
102
- public function getOnlineCount ($ faction = false )
103
+ public function getOnlineCount (bool | string $ faction = false ): int
103
104
{
104
105
// Make sure we're connected
105
106
$ this ->connect ();
@@ -109,11 +110,11 @@ public function getOnlineCount($faction = false)
109
110
$ query = $ this ->db ->query ("SELECT COUNT(*) as `total` FROM " . table ("characters " , $ this ->realmId ) . " WHERE " . column ("characters " , "online " , false , $ this ->realmId ) . "='1' " );
110
111
break ;
111
112
112
- case " alliance " :
113
+ case ' alliance ' :
113
114
$ query = $ this ->db ->query ("SELECT COUNT(*) as `total` FROM " . table ("characters " , $ this ->realmId ) . " WHERE " . column ("characters " , "online " , false , $ this ->realmId ) . "='1' AND " . column ("characters " , "race " ) . " IN( " . implode (", " , get_instance ()->realms ->getAllianceRaces ()) . ") " );
114
115
break ;
115
116
116
- case " horde " :
117
+ case ' horde ' :
117
118
$ query = $ this ->db ->query ("SELECT COUNT(*) as `total` FROM " . table ("characters " , $ this ->realmId ) . " WHERE " . column ("characters " , "online " , false , $ this ->realmId ) . "='1' AND " . column ("characters " , "race " ) . " IN( " . implode (", " , get_instance ()->realms ->getHordeRaces ()) . ") " );
118
119
break ;
119
120
}
@@ -138,12 +139,12 @@ public function getOnlineCount($faction = false)
138
139
}
139
140
140
141
/**
141
- * Count the characters that belongs to one account
142
+ * Count the characters that belong to one account
142
143
*
143
- * @param Int $account
144
+ * @param Int $account
144
145
* @return Int
145
146
*/
146
- public function getCharacterCount ($ account )
147
+ public function getCharacterCount (int $ account ): int
147
148
{
148
149
$ this ->connect ();
149
150
@@ -166,29 +167,28 @@ public function getCharacterCount($account)
166
167
}
167
168
168
169
/**
169
- * Get the characters that belongs to one account
170
+ * Get the characters that belong to one account
170
171
*
171
- * @param Int $acc
172
+ * @param false| Int $acc
172
173
* @return Array
173
174
*/
174
- public function getCharactersByAccount ($ acc = false )
175
+ public function getCharactersByAccount (false | int $ acc = false ): array
175
176
{
176
- if ($ acc == false ) {
177
+ if (! $ acc ) {
177
178
$ CI = &get_instance ();
178
179
$ acc = $ CI ->user ->getId ();
179
180
}
180
181
181
-
182
- return $ this ->getCharacters (columns ("characters " , array ("guid " , "name " , "race " , "class " , "gender " , "level " , "online " , "money " ), $ this ->realmId ), array (column ("characters " , "account " , false , $ this ->realmId ) => $ acc ));
182
+ return $ this ->getCharacters (columns ("characters " , ["guid " , "name " , "race " , "class " , "gender " , "level " , "online " , "money " , "zone " ], $ this ->realmId ), [column ("characters " , "account " , false , $ this ->realmId ) => $ acc ]);
183
183
}
184
184
185
185
/**
186
- * Get the character guid by the name
186
+ * Get the character guid by the name
187
187
*
188
- * @param String $name
189
- * @return Int
190
- */
191
- public function getGuidByName ($ name )
188
+ * @param String $name
189
+ * @return false|int
190
+ */
191
+ public function getGuidByName (string $ name ): false | int
192
192
{
193
193
$ this ->connect ();
194
194
0 commit comments