/**
* Returns the gender for given username.
- * @param $username String or User: username
- * @param $caller String: the calling method
+ * @param string $username or User: username
+ * @param string $caller the calling method
* @return String
*/
public function getGenderOf( $username, $caller = '' ) {
$this->doQuery( array_keys( $users ), $caller );
}
+ /**
+ * Wrapper for doQuery that processes a title or string array.
+ *
+ * @since 1.20
+ * @param $titles List: array of Title objects or strings
+ * @param string $caller the calling method
+ */
+ public function doTitlesArray( $titles, $caller = '' ) {
+ $users = array();
+ foreach ( $titles as $title ) {
+ $titleObj = is_string( $title ) ? Title::newFromText( $title ) : $title;
+ if ( !$titleObj ) {
+ continue;
+ }
+ if ( !MWNamespace::hasGenderDistinction( $titleObj->getNamespace() ) ) {
+ continue;
+ }
+ $users[] = $titleObj->getText();
+ }
+
+ $this->doQuery( $users, $caller );
+ }
+
/**
* Preloads genders for given list of users.
* @param $users List|String: usernames
- * @param $caller String: the calling method
+ * @param string $caller the calling method
*/
public function doQuery( $users, $caller = '' ) {
$default = $this->getDefault();