/**
* Button cannot be invalid
*
- * @param $value String
- * @param $alldata Array
+ * @param string $value
+ * @param array $alldata
*
- * @return Bool
+ * @return bool
*/
public function validate( $value, $alldata ) {
return true;
/**
* For a checkbox, the label goes on the right hand side, and is
* added in getInputHTML(), rather than HTMLFormField::getRow()
- * @return String
+ * @return string
*/
function getLabel() {
return ' ';
/**
* checkboxes don't need a label.
+ * @return bool
*/
protected function needsLabel() {
return false;
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return String
+ * @return string
*/
function loadDataFromRequest( $request ) {
$invert = false;
* mParams['rows'] is an array with row labels as keys and row tags as values.
* mParams['columns'] is an array with column labels as keys and column tags as values.
*
- * @param array $value of the options that should be checked
+ * @param array $value Array of the options that should be checked
*
- * @return String
+ * @return string
*/
function getInputHTML( $value ) {
$html = '';
* line above the options in the case of a checkbox matrix, i.e. it's always
* a "vertical-label".
*
- * @param string $value the value to set the input to
+ * @param string $value The value to set the input to
*
- * @return String complete HTML table row
+ * @return string Complete HTML table row
*/
function getTableRow( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return Array
+ * @return array
*/
function loadDataFromRequest( $request ) {
if ( $this->mParent->getMethod() == 'post' ) {
/**
* Format in which to display form. For viable options,
* @see $availableDisplayFormats
- * @var String
+ * @var string
*/
protected $displayFormat = 'table';
/**
* Available formats in which to display the form
- * @var Array
+ * @var array
*/
protected $availableDisplayFormats = array(
'table',
/**
* Build a new HTMLForm from an array of field attributes
*
- * @param array $descriptor of Field constructs, as described above
- * @param $context IContextSource available since 1.18, will become compulsory in 1.18.
+ * @param array $descriptor Array of Field constructs, as described above
+ * @param IContextSource $context Available since 1.18, will become compulsory in 1.18.
* Obviates the need to call $form->setTitle()
- * @param string $messagePrefix a prefix to go in front of default messages
+ * @param string $messagePrefix A prefix to go in front of default messages
*/
public function __construct( $descriptor, /*IContextSource*/ $context = null,
$messagePrefix = ''
/**
* Set format in which to display the form
*
- * @param string $format the name of the format to use, must be one of
- * $this->availableDisplayFormats
+ * @param string $format The name of the format to use, must be one of
+ * $this->availableDisplayFormats
*
* @throws MWException
* @since 1.20
/**
* Getter for displayFormat
* @since 1.20
- * @return String
+ * @return string
*/
public function getDisplayFormat() {
return $this->displayFormat;
/**
* Test if displayFormat is 'vform'
* @since 1.22
- * @return Bool
+ * @return bool
*/
public function isVForm() {
return $this->displayFormat === 'vform';
/**
* Try submitting, with edit token check first
- * @return Status|boolean
+ * @return Status|bool
*/
function tryAuthorizedSubmit() {
$result = false;
* The here's-one-I-made-earlier option: do the submission if
* posted, or display the form with or without funky validation
* errors
- * @return Bool or Status whether submission was successful.
+ * @return bool|Status Whether submission was successful.
*/
function show() {
$this->prepareForm();
* Validate all the fields, and call the submission callback
* function if everything is kosher.
* @throws MWException
- * @return Mixed Bool true == Successful submission, Bool false
+ * @return mixed Bool true == Successful submission, Bool false
* == No submission attempted, anything else == Error to
* display.
*/
* Set a callback to a function to do something with the form
* once it's been successfully validated.
*
- * @param string $cb function name. The function will be passed
+ * @param string $cb Function name. The function will be passed
* the output from HTMLForm::filterDataForSubmit, and must
* return Bool true on success, Bool false if no submission
* was attempted, or String HTML output to display on error.
/**
* Set a message to display on a validation error.
*
- * @param $msg Mixed String or Array of valid inputs to wfMessage()
+ * @param string|array $msg String or Array of valid inputs to wfMessage()
* (so each entry can be either a String or Array)
*
* @return HTMLForm $this for chaining calls (since 1.20)
/**
* Set the introductory message, overwriting any existing message.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* Set the introductory message, overwriting any existing message.
* @since 1.19
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add introductory text.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add header text, inside the form.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
* @param string $section The section to add the header to
*
* @return HTMLForm $this for chaining calls (since 1.20)
* Set header text, inside the form.
* @since 1.19
*
- * @param string $msg complete text of message to display
- * @param $section The section to add the header to
+ * @param string $msg Complete text of message to display
+ * @param string $section The section to add the header to
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* Set footer text, inside the form.
* @since 1.19
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
* @param string $section The section to add the footer text to
*
* @return HTMLForm $this for chaining calls (since 1.20)
/**
* Add text to the end of the display.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set text at the end of the display.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add a hidden field to the output
*
- * @param string $name field name. This will be used exactly as entered
- * @param string $value field value
- * @param $attribs Array
+ * @param string $name Field name. This will be used exactly as entered
+ * @param string $value Field value
+ * @param array $attribs
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add a button to the form
*
- * @param string $name field name.
- * @param string $value field value
+ * @param string $name Field name.
+ * @param string $value Field value
* @param string $id DOM id for the button (default: null)
- * @param $attribs Array
+ * @param array $attribs
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* Moreover, when doing method chaining this should be the very last method
* call just after prepareForm().
*
- * @param $submitResult Mixed output from HTMLForm::trySubmit()
+ * @param mixed $submitResult Mixed output from HTMLForm::trySubmit()
*
* @return Nothing, should be last call
*/
/**
* Returns the raw HTML generated by the form
*
- * @param $submitResult Mixed output from HTMLForm::trySubmit()
+ * @param mixed $submitResult Mixed output from HTMLForm::trySubmit()
*
* @return string
*/
*
* @param string $html HTML contents to wrap.
*
- * @return String wrapped HTML.
+ * @return string Wrapped HTML.
*/
function wrapForm( $html ) {
/**
* Get the hidden fields that should go inside the form.
- * @return String HTML.
+ * @return string HTML.
*/
function getHiddenFields() {
global $wgArticlePath;
/**
* Get the submit and (potentially) reset buttons.
- * @return String HTML.
+ * @return string HTML.
*/
function getButtons() {
$buttons = '';
/**
* Get the whole body of the form.
- * @return String
+ * @return string
*/
function getBody() {
return $this->displaySection( $this->mFieldTree, $this->mTableId );
/**
* Format and display an error message stack.
*
- * @param $errors String|Array|Status
+ * @param string|array|Status $errors
*
- * @return String
+ * @return string
*/
function getErrors( $errors ) {
if ( $errors instanceof Status ) {
*
* @param array $errors of message keys/values
*
- * @return String HTML, a "<ul>" list of errors
+ * @return string HTML, a "<ul>" list of errors
*/
public static function formatErrors( $errors ) {
$errorstr = '';
* Set the text for the submit button to a message
* @since 1.19
*
- * @param string $msg message key
+ * @param string $msg Message key
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set the id for the submit button.
*
- * @param $t String.
+ * @param string $t
*
* @todo FIXME: Integrity of $t is *not* validated
* @return HTMLForm $this for chaining calls (since 1.20)
*
* @since 1.22
*
- * @param string $id new value of the id attribute, or "" to remove
+ * @param string $id New value of the id attribute, or "" to remove
*
* @return HTMLForm $this for chaining calls
*/
* this message as its "<legend>" element.
* @since 1.19
*
- * @param string $msg message key
+ * @param string $msg Message key
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* @todo Currently only used for the "<fieldset>" legend on forms
* with multiple sections; should be used elsewhere?
*
- * @param $p String
+ * @param string $p
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set the title for form submission
*
- * @param $t Title of page the form is on/should be posted to
+ * @param Title $t Title of page the form is on/should be posted to
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set the method used to submit the form
*
- * @param $method String
+ * @param string $method
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* section, ignored if empty.
* @param string $fieldsetIDPrefix ID prefix for the "<fieldset>" tag of
* each subsection, ignored if empty.
- * @param boolean &$hasUserVisibleFields Whether the section had user-visible fields.
+ * @param bool &$hasUserVisibleFields Whether the section had user-visible fields.
*
- * @return String
+ * @return string
*/
public function displaySection( $fields,
$sectionName = '',
/**
* Stop a reset button being shown for this form
*
- * @param bool $suppressReset set to false to re-enable the
- * button again
+ * @param bool $suppressReset Set to false to re-enable the button again
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* to the form as a whole, after it's submitted but before it's
* processed.
*
- * @param $data
+ * @param array $data
*
* @return
*/
* Get a string to go in the "<legend>" of a section fieldset.
* Override this if you want something more complicated.
*
- * @param $key String
+ * @param string $key
*
- * @return String
+ * @return string
*/
public function getLegend( $key ) {
return $this->msg( "{$this->mMessagePrefix}-$key" )->text();
*
* Parameters are the same as wfMessage().
*
- * @return Message object
+ * @return Message
*/
function msg() {
$args = func_get_args();
* @param string $value The value the field was submitted with
* @param array $alldata The data collected from the form
*
- * @return Mixed Bool true on success, or String error to display.
+ * @return bool|string true on success, or String error to display.
*/
function validate( $value, $alldata ) {
if ( isset( $this->mParams['required'] )
* or the input's default value if it has not been set.
*
* @param WebRequest $request
- * @return String the value
+ * @return string The value
*/
function loadDataFromRequest( $request ) {
if ( $request->getCheck( $this->mName ) ) {
*
* @param string|null $helptext
*
- * @return String
+ * @return string
*/
public function getHelpTextHtmlDiv( $helptext ) {
if ( is_null( $helptext ) ) {
* @since 1.20
*
* @param string|null $helptext
- * @return String
+ * @return string
*/
public function getHelpTextHtmlRaw( $helptext ) {
return $this->getHelpTextHtmlDiv( $helptext );
* flatten an array of options to a single array, for instance,
* a set of "<options>" inside "<optgroups>".
*
- * @param array $options Associative Array with values either Strings
- * or Arrays
+ * @param array $options Associative Array with values either Strings or Arrays
* @return array Flattened input
*/
public static function flattenOptions( $options ) {
/**
* Formats one or more errors as accepted by field validation-callback.
*
- * @param string|Message|array $errors String|Message|Array of strings or Message instances
+ * @param string|Message|array $errors Array of strings or Message instances
* @return string HTML
* @since 1.18
*/
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return String
+ * @return string
*/
function loadDataFromRequest( $request ) {
if ( $this->mParent->getMethod() == 'post' ) {
* Support for seperating multi-option preferences into multiple preferences
* Due to lack of array support.
*
- * @param $data array
+ * @param array $data
*/
function filterDataForSubmit( $data );
}
* This returns a block of all the radio options, in one cell.
* @see includes/HTMLFormField#getInputHTML()
*
- * @param $value String
+ * @param string $value
*
- * @return String
+ * @return string
*/
function getInputHTML( $value ) {
$html = $this->formatOptions( $this->getOptions(), strval( $value ) );
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return Array("<overall message>","<select value>","<text field value>")
+ * @return array("<overall message>","<select value>","<text field value>")
*/
function loadDataFromRequest( $request ) {
if ( $request->getCheck( $this->mName ) ) {
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return String
+ * @return string
*/
function loadDataFromRequest( $request ) {
if ( $request->getCheck( $this->mName ) ) {
* This may add duplicate at insert time, but they will be
* removed later on, when the first one is popped.
*
- * @param array $jobs of Job objects
+ * @param array $jobs Array of Job objects
* @return bool
* @deprecated since 1.21
*/
* be rolled-back as part of a larger transaction. However,
* large batches of jobs can cause slave lag.
*
- * @param array $jobs of Job objects
+ * @param array $jobs Array of Job objects
* @return bool
* @deprecated since 1.21
*/
* actually find a job; it may be adversely affected by concurrent job
* runners.
*
- * @param $type string
+ * @param string $type
* @return Job|bool Returns false if there are no jobs
* @deprecated since 1.21
*/
*------------------------------------------------------------------------*/
/**
- * @param $command
- * @param $title
- * @param $params array|bool
+ * @param string $command
+ * @param Title $title
+ * @param array|bool $params
*/
public function __construct( $command, $title, $params = false ) {
$this->command = $command;
}
/**
- * @return integer Number of actually "work items" handled in this job
+ * @return int Number of actually "work items" handled in this job
* @see $wgJobBackoffThrottling
* @since 1.23
*/
/**
* @see JobQueue::batchPush()
* @param array $jobs
- * @param $flags
+ * @param array $flags
*/
abstract protected function doBatchPush( array $jobs, $flags );
/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param $flags
+ * @param array $flags
* @throws DBError|Exception
* @return bool
*/
* Reserve a row with a single UPDATE without holding row locks over RTTs...
*
* @param string $uuid 32 char hex string
- * @param $rand integer Random unsigned integer (31 bits)
+ * @param int $rand Random unsigned integer (31 bits)
* @param bool $gte Search for job_random >= $random (otherwise job_random <= $random)
* @return stdClass|bool Row|false
*/
}
/**
- * @param $index integer (DB_SLAVE/DB_MASTER)
+ * @param int $index (DB_SLAVE/DB_MASTER)
* @return DBConnRef
*/
protected function getDB( $index ) {
}
/**
- * @param $property
+ * @param string $property
* @return string
*/
private function getCacheKey( $property ) {
}
/**
- * @param $params
+ * @param array|bool $params
* @return string
*/
protected static function makeBlob( $params ) {
}
/**
- * @param $blob
+ * @param string $blob
* @return bool|mixed
*/
protected static function extractBlob( $blob ) {
}
/**
- * @param $property
+ * @param string $property
* @return string
*/
private function getCacheKey( $property ) {
/**
* Check if there are any queues with jobs (this is cached)
*
- * @param integer $type JobQueueGroup::TYPE_* constant
+ * @param int $type JobQueueGroup::TYPE_* constant
* @return bool
* @since 1.23
*/
}
/**
- * @param $name string
+ * @param string $name
* @return mixed
*/
private function getCachedConfigVar( $name ) {
/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param $flags
+ * @param array $flags
* @return bool
* @throws JobQueueError
*/
/**
* @param RedisConnRef $conn
- * @return array serialized string or false
+ * @return array Serialized string or false
* @throws RedisException
*/
protected function popAndDeleteBlob( RedisConnRef $conn ) {
/**
* @param RedisConnRef $conn
- * @return array serialized string or false
+ * @return array Serialized string or false
* @throws RedisException
*/
protected function popAndAcquireBlob( RedisConnRef $conn ) {
/**
* This function should not be called outside JobQueueRedis
*
- * @param $uid string
- * @param $conn RedisConnRef
+ * @param string $uid
+ * @param RedisConnRef $conn
* @return Job|bool Returns false if the job does not exist
* @throws MWException|JobQueueError
*/
}
/**
- * @param $fields array
+ * @param array $fields
* @return Job|bool
*/
protected function getJobFromFields( array $fields ) {
}
/**
- * @param $conn RedisConnRef
- * @param $e RedisException
+ * @param RedisConnRef $conn
+ * @param RedisException $e
* @throws JobQueueError
*/
protected function throwRedisException( RedisConnRef $conn, $e ) {
}
/**
- * @param $prop string
- * @param $type string|null
+ * @param string $prop
+ * @param string|null $type
* @return string
*/
private function getQueueKey( $prop, $type = null ) {
}
/**
- * @param $key string
+ * @param string $key
* @return void
*/
public function setTestingPrefix( $key ) {
/**
* Insert jobs into the job queue to fix redirects to the given title
- * @param string $reason the reason for the fix, see message
+ * @param string $reason The reason for the fix, see message
* "double-redirect-fixed-<reason>"
- * @param $redirTitle Title: the title which has changed, redirects
+ * @param Title $redirTitle The title which has changed, redirects
* pointing to this title are fixed
* @param bool $destTitle Not used
*/
/**
* Get the final destination of a redirect
*
- * @param $title Title
+ * @param Title $title
*
- * @return bool if the specified title is not a redirect, or if it is a circular redirect
+ * @return bool If the specified title is not a redirect, or if it is a circular redirect
*/
public static function getFinalDestination( $title ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Run a refreshLinks2 job
- * @return boolean success
+ * @return bool Success
*/
function run() {
global $wgUpdateRowsPerJob;
}
/**
- * @param $table string
- * @param $masterPos mixed
- * @return Array
+ * @param string $table
+ * @param mixed $masterPos
+ * @return array
*/
protected function getSingleTitleJobs( $table, $masterPos ) {
# The "start"/"end" fields are not set for the base jobs
}
/**
- * @return Array
+ * @return array
*/
public function getDeduplicationInfo() {
$info = parent::getDeduplicationInfo();
}
/**
- * @param $key
+ * @param string $key
* @return mixed
*/
public static function &getSessionData( $key ) {
* @param array $info Module info array. For backwards compatibility with 1.17alpha,
* this may also be a ResourceLoaderModule object. Optional when using
* multiple-registration calling style.
- * @throws MWException: If a duplicate module registration is attempted
- * @throws MWException: If a module name contains illegal characters (pipes or commas)
- * @throws MWException: If something other than a ResourceLoaderModule is being registered
- * @return boolean False if there were any errors, in which case one or more modules were
+ * @throws MWException If a duplicate module registration is attempted
+ * @throws MWException If a module name contains illegal characters (pipes or commas)
+ * @throws MWException If something other than a ResourceLoaderModule is being registered
+ * @return bool False if there were any errors, in which case one or more modules were
* not registered
*/
public function register( $name, $info = null ) {
*
* @param string $framework Get only the test module names for one
* particular framework (optional)
- * @return Array
+ * @return array
*/
public function getTestModuleNames( $framework = 'all' ) {
/// @todo api siteinfo prop testmodulenames modulenames
* If there's an If-Modified-Since header, respond with a 304 appropriately
* and clear out the output buffer. If the client cache is too old then do nothing.
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @param string $mtime The TS_MW timestamp to check the header against
* @return bool True if 304 header sent and output handled
*/
/**
* Handle exception display.
*
- * @param Exception $e to be shown to the user
- * @return string sanitized text that can be returned to the user
+ * @param Exception $e Exception to be shown to the user
+ * @return string Sanitized text that can be returned to the user
*/
public static function formatException( $e ) {
global $wgShowExceptionDetails;
/**
* Generate code for a response.
*
- * @param $context ResourceLoaderContext Context in which to generate a response
+ * @param ResourceLoaderContext $context Context in which to generate a response
* @param array $modules List of module objects keyed by module name
* @param array $missing List of requested module names that are unregistered (optional)
* @return string Response data
* Set the state of modules with the given names to the given states
*
* @param string $name
- * @param $state
+ * @param string $state
* @return string
*/
public static function makeLoaderStateScript( $name, $state = null ) {
* - ResourceLoader::makeLoaderSourcesScript( array( $id1 => $props1, $id2 => $props2, ... ) );
* Register sources with the given IDs and properties.
*
- * @param string $id source ID
- * @param array $properties source properties (see addSource())
+ * @param string $id Source ID
+ * @param array $properties Source properties (see addSource())
* @return string
*/
public static function makeLoaderSourcesScript( $id, $properties = null ) {
/**
* Build a load.php URL
- * @param array $modules of module names (strings)
+ * @param array $modules Array of module names (strings)
* @param string $lang Language code
* @param string $skin Skin name
* @param string|null $user User name. If null, the &user= parameter is omitted
* Get global LESS variables.
*
* $since 1.22
- * @return array: Map of variable names to string CSS values.
+ * @return array Map of variable names to string CSS values.
*/
public static function getLESSVars() {
global $wgResourceLoaderLESSVars;
/* Methods */
/**
- * @param $resourceLoader ResourceLoader
- * @param $request WebRequest
+ * @param ResourceLoader $resourceLoader
+ * @param WebRequest $request
*/
public function __construct( $resourceLoader, WebRequest $request ) {
global $wgDefaultSkin, $wgResourceLoaderDebug;
* an array of module names like array( 'jquery.foo', 'jquery.bar',
* 'jquery.ui.baz', 'jquery.ui.quux' )
* @param string $modules Packed module name list
- * @return array of module names
+ * @return array Array of module names
*/
public static function expandModuleNames( $modules ) {
$retval = array();
}
/**
- * @return String|null
+ * @return string|null
*/
public function getOnly() {
return $this->only;
}
/**
- * @return String|null
+ * @return string|null
*/
public function getVersion() {
return $this->version;
/* Protected Members */
- /** String: Local base path, see __construct() */
+ /** @var string Local base path, see __construct() */
protected $localBasePath = '';
- /** String: Remote base path, see __construct() */
+ /** @var string Remote base path, see __construct() */
protected $remoteBasePath = '';
/**
- * Array: List of paths to JavaScript files to always include
+ * @var array List of paths to JavaScript files to always include
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $scripts = array();
/**
- * Array: List of JavaScript files to include when using a specific language
+ * @var array List of JavaScript files to include when using a specific language
* @par Usage:
* @code
* array( [language-code] => array( [file-path], [file-path], ... ), ... )
*/
protected $languageScripts = array();
/**
- * Array: List of JavaScript files to include when using a specific skin
+ * @var array List of JavaScript files to include when using a specific skin
* @par Usage:
* @code
* array( [skin-name] => array( [file-path], [file-path], ... ), ... )
*/
protected $skinScripts = array();
/**
- * Array: List of paths to JavaScript files to include in debug mode
+ * @var array List of paths to JavaScript files to include in debug mode
* @par Usage:
* @code
* array( [skin-name] => array( [file-path], [file-path], ... ), ... )
*/
protected $debugScripts = array();
/**
- * Array: List of paths to JavaScript files to include in the startup module
+ * @var array List of paths to JavaScript files to include in the startup module
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $loaderScripts = array();
/**
- * Array: List of paths to CSS files to always include
+ * @var array List of paths to CSS files to always include
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $styles = array();
/**
- * Array: List of paths to CSS files to include when using specific skins
+ * @var array List of paths to CSS files to include when using specific skins
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $skinStyles = array();
/**
- * Array: List of modules this module depends on
+ * @var array List of modules this module depends on
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $dependencies = array();
/**
- * Array: List of message keys used by this module
+ * @var array List of message keys used by this module
* @par Usage:
* @code
* array( [message-key], [message-key], ... )
* @endcode
*/
protected $messages = array();
- /** String: Name of group to load this module in */
+ /** @var string Name of group to load this module in */
protected $group;
- /** String: Position on the page to load this module at */
+ /** @var string Position on the page to load this module at */
protected $position = 'bottom';
- /** Boolean: Link to raw files in debug mode */
+ /** @var bool Link to raw files in debug mode */
protected $debugRaw = true;
- /** Boolean: Whether mw.loader.state() call should be omitted */
+ /** @var bool Whether mw.loader.state() call should be omitted */
protected $raw = false;
protected $targets = array( 'desktop' );
/**
- * Boolean: Whether getStyleURLsForDebug should return raw file paths,
+ * @var bool Whether getStyleURLsForDebug should return raw file paths,
* or return load.php urls
*/
protected $hasGeneratedStyles = false;
/**
- * Array: Cache for mtime
+ * @var array Cache for mtime
* @par Usage:
* @code
* array( [hash] => [mtime], [hash] => [mtime], ... )
*/
protected $modifiedTime = array();
/**
- * Array: Place where readStyleFile() tracks file dependencies
+ * @var array Place where readStyleFile() tracks file dependencies
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
* Gets all scripts for a given context concatenated together.
*
* @param ResourceLoaderContext $context Context in which to generate script
- * @return string: JavaScript code for $context
+ * @return string JavaScript code for $context
*/
public function getScript( ResourceLoaderContext $context ) {
$files = $this->getScriptFiles( $context );
/**
* Gets loader script.
*
- * @return string: JavaScript code to be added to startup module
+ * @return string JavaScript code to be added to startup module
*/
public function getLoaderScript() {
if ( count( $this->loaderScripts ) == 0 ) {
* Gets all styles for a given context concatenated together.
*
* @param ResourceLoaderContext $context Context in which to generate styles
- * @return string: CSS code for $context
+ * @return string CSS code for $context
*/
public function getStyles( ResourceLoaderContext $context ) {
$styles = $this->readStyleFiles(
/**
* Gets list of message keys used by this module.
*
- * @return array: List of message keys
+ * @return array List of message keys
*/
public function getMessages() {
return $this->messages;
/**
* Gets the name of the group this module should be loaded in.
*
- * @return string: Group name
+ * @return string Group name
*/
public function getGroup() {
return $this->group;
/**
* Gets list of names of modules this module depends on.
*
- * @return array: List of module names
+ * @return array List of module names
*/
public function getDependencies() {
return $this->dependencies;
*
* @param ResourceLoaderContext $context Context in which to calculate
* the modified time
- * @return int: UNIX timestamp
+ * @return int UNIX timestamp
* @see ResourceLoaderModule::getFileDependencies
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
/**
* Get the definition summary for this module.
*
- * @return Array
+ * @return array
*/
public function getDefinitionSummary( ResourceLoaderContext $context ) {
$summary = array(
*
* @since 1.22
* @param string $path
- * @return string: the stylesheet language name
+ * @return string The stylesheet language name
*/
public function getStyleSheetLang( $path ) {
return preg_match( '/\.less$/i', $path ) ? 'less' : 'css';
*
* @param array $list List of file paths in any combination of index/path
* or path/options pairs
- * @param string $option option name
- * @param mixed $default default value if the option isn't set
- * @return array: List of file paths, collated by $option
+ * @param string $option Option name
+ * @param mixed $default Default value if the option isn't set
+ * @return array List of file paths, collated by $option
*/
protected static function collateFilePathListByOption( array $list, $option, $default ) {
$collatedFiles = array();
* @param array $list List of lists to select from
* @param string $key Key to look for in $map
* @param string $fallback Key to look for in $list if $key doesn't exist
- * @return array: List of elements from $map which matched $key or $fallback,
+ * @return array List of elements from $map which matched $key or $fallback,
* or an empty list in case of no match
*/
protected static function tryForKey( array $list, $key, $fallback = null ) {
* Gets a list of file paths for all scripts in this module, in order of propper execution.
*
* @param ResourceLoaderContext $context
- * @return array: List of file paths
+ * @return array List of file paths
*/
protected function getScriptFiles( ResourceLoaderContext $context ) {
$files = array_merge(
* Gets a list of file paths for all styles in this module, in order of propper inclusion.
*
* @param ResourceLoaderContext $context
- * @return array: List of file paths
+ * @return array List of file paths
*/
protected function getStyleFiles( ResourceLoaderContext $context ) {
return array_merge_recursive(
*
* @param array $scripts List of file paths to scripts to read, remap and concetenate
* @throws MWException
- * @return string: Concatenated and remapped JavaScript data from $scripts
+ * @return string Concatenated and remapped JavaScript data from $scripts
*/
protected function readScriptFiles( array $scripts ) {
global $wgResourceLoaderValidateStaticJS;
* @param bool $flip
*
* @throws MWException
- * @return array: List of concatenated and remapped CSS data from $styles,
+ * @return array List of concatenated and remapped CSS data from $styles,
* keyed by media type
*/
protected function readStyleFiles( array $styles, $flip ) {
* @param string $path File path of style file to read
* @param bool $flip
*
- * @return string: CSS data in script file
+ * @return string CSS data in script file
* @throws MWException if the file doesn't exist
*/
protected function readStyleFile( $path, $flip ) {
/**
* Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
*
- * @return array of strings
+ * @return array Array of strings
*/
public function getTargets() {
return $this->targets;
*
* @since 1.22
* @param string $fileName File name of root LESS file.
- * @return string: Cache key
+ * @return string Cache key
*/
protected static function getLESSCacheKey( $fileName ) {
$vars = json_encode( ResourceLoader::getLESSVars() );
* @throws Exception If Less encounters a parse error
* @throws MWException If Less compilation returns unexpection result
* @param string $fileName File path of LESS source
- * @return string: CSS source
+ * @return string CSS source
*/
protected function compileLESSFile( $fileName ) {
$key = self::getLESSCacheKey( $fileName );
class ResourceLoaderFilePageModule extends ResourceLoaderWikiModule {
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
protected function getPages( ResourceLoaderContext $context ) {
}
/**
- * @param $context ResourceLoaderContext
- * @return string: JavaScript code
+ * @param ResourceLoaderContext $context
+ * @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
$this->language = Language::factory( $context->getLanguage() );
}
/**
- * @param $context ResourceLoaderContext
- * @return int: UNIX timestamp
+ * @param ResourceLoaderContext $context
+ * @return int UNIX timestamp
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
return max( 1, $this->getHashMtime( $context ) );
}
/**
- * @param $context ResourceLoaderContext
- * @return string: Hash
+ * @param ResourceLoaderContext $context
+ * @return string Hash
*/
public function getModifiedHash( ResourceLoaderContext $context ) {
$this->language = Language::factory( $context->getLanguage() );
* Get this module's name. This is set when the module is registered
* with ResourceLoader::register()
*
- * @return mixed: Name (string) or null if no name was set
+ * @return string|null Name (string) or null if no name was set
*/
public function getName() {
return $this->name;
* Get this module's origin. This is set when the module is registered
* with ResourceLoader::register()
*
- * @return int: ResourceLoaderModule class constant, the subclass default
+ * @return int ResourceLoaderModule class constant, the subclass default
* if not set manually
*/
public function getOrigin() {
* Set this module's origin. This is called by ResourceLoader::register()
* when registering the module. Other code should not call this.
*
- * @param int $origin origin
+ * @param int $origin Origin
*/
public function setOrigin( $origin ) {
$this->origin = $origin;
* Includes all relevant JS except loader scripts.
*
* @param ResourceLoaderContext $context
- * @return string: JavaScript code
+ * @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
// Stub, override expected
* MUST return either an only= URL or a non-load.php URL.
*
* @param ResourceLoaderContext $context
- * @return array: Array of URLs
+ * @return array Array of URLs
*/
public function getScriptURLsForDebug( ResourceLoaderContext $context ) {
$url = ResourceLoader::makeLoaderURL(
* Get all CSS for this module for a given skin.
*
* @param ResourceLoaderContext $context
- * @return array: List of CSS strings or array of CSS strings keyed by media type.
+ * @return array List of CSS strings or array of CSS strings keyed by media type.
* like array( 'screen' => '.foo { width: 0 }' );
* or array( 'screen' => array( '.foo { width: 0 }' ) );
*/
* load the files directly. See also getScriptURLsForDebug()
*
* @param ResourceLoaderContext $context
- * @return array: array( mediaType => array( URL1, URL2, ... ), ... )
+ * @return array array( mediaType => array( URL1, URL2, ... ), ... )
*/
public function getStyleURLsForDebug( ResourceLoaderContext $context ) {
$url = ResourceLoader::makeLoaderURL(
*
* To get a JSON blob with messages, use MessageBlobStore::get()
*
- * @return array: List of message keys. Keys may occur more than once
+ * @return array List of message keys. Keys may occur more than once
*/
public function getMessages() {
// Stub, override expected
/**
* Get the group this module is in.
*
- * @return string: Group name
+ * @return string Group name
*/
public function getGroup() {
// Stub, override expected
/**
* Get the origin of this module. Should only be overridden for foreign modules.
*
- * @return string: Origin name, 'local' for local modules
+ * @return string Origin name, 'local' for local modules
*/
public function getSource() {
// Stub, override expected
/**
* Get the loader JS for this module, if set.
*
- * @return mixed: JavaScript loader code as a string or boolean false if no custom loader set
+ * @return mixed JavaScript loader code as a string or boolean false if no custom loader set
*/
public function getLoaderScript() {
// Stub, override expected
*
* To add dependencies dynamically on the client side, use a custom
* loader script, see getLoaderScript()
- * @return array: List of module names as strings
+ * @return array List of module names as strings
*/
public function getDependencies() {
// Stub, override expected
/**
* Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
*
- * @return array: Array of strings
+ * @return array Array of strings
*/
public function getTargets() {
return $this->targets;
* Currently these are only image files referenced by the module's CSS.
*
* @param string $skin Skin name
- * @return array: List of files
+ * @return array List of files
*/
public function getFileDependencies( $skin ) {
// Try in-object cache first
* Get the last modification timestamp of the message blob for this
* module in a given language.
* @param string $lang Language code
- * @return int: UNIX timestamp, or 0 if the module doesn't have messages
+ * @return int UNIX timestamp, or 0 if the module doesn't have messages
*/
public function getMsgBlobMtime( $lang ) {
if ( !isset( $this->msgBlobMtime[$lang] ) ) {
* Set a preloaded message blob last modification timestamp. Used so we
* can load this information for all modules at once.
* @param string $lang Language code
- * @param $mtime Integer: UNIX timestamp or 0 if there is no such blob
+ * @param int $mtime UNIX timestamp or 0 if there is no such blob
*/
public function setMsgBlobMtime( $lang, $mtime ) {
$this->msgBlobMtime[$lang] = $mtime;
* yourself and take its result into consideration.
*
* @param ResourceLoaderContext $context Context object
- * @return integer UNIX timestamp
+ * @return int UNIX timestamp
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
// 0 would mean now
* Helper method for calculating when the module's hash (if it has one) changed.
*
* @param ResourceLoaderContext $context
- * @return integer: UNIX timestamp or 0 if no hash was provided
+ * @return int UNIX timestamp or 0 if no hash was provided
* by getModifiedHash()
*/
public function getHashMtime( ResourceLoaderContext $context ) {
* use of getHashMTime() inside getModifiedTime().
*
* @param ResourceLoaderContext $context
- * @return string|null: Hash
+ * @return string|null Hash
*/
public function getModifiedHash( ResourceLoaderContext $context ) {
return null;
/**
* Helper method for calculating when this module's definition summary was last changed.
*
- * @return integer: UNIX timestamp or 0 if no definition summary was provided
+ * @return int UNIX timestamp or 0 if no definition summary was provided
* by getDefinitionSummary()
*/
public function getDefinitionMtime( ResourceLoaderContext $context ) {
* contain arrays and scalars as values (avoid object instances) which means
* it requires abstraction.
*
- * @return Array|null
+ * @return array|null
*/
public function getDefinitionSummary( ResourceLoaderContext $context ) {
return array(
*
* @param string $fileName
* @param string $contents
- * @return string: JS with the original, or a replacement error
+ * @return string JS with the original, or a replacement error
*/
protected function validateScriptFile( $fileName, $contents ) {
global $wgResourceLoaderValidateJS;
* Gets list of pages used by this module. Obviously, it makes absolutely no
* sense to include JavaScript files here... :D
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
*
- * @return Array: List of pages
+ * @return array List of pages
*/
protected function getPages( ResourceLoaderContext $context ) {
return array( 'MediaWiki:Noscript.css' => array( 'type' => 'style' ) );
/**
* Gets group name
*
- * @return String: Name of group
+ * @return string Name of group
*/
public function getGroup() {
return 'noscript';
/**
* Gets list of pages used by this module
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
*
- * @return Array: List of pages
+ * @return array List of pages
*/
protected function getPages( ResourceLoaderContext $context ) {
global $wgUseSiteJs, $wgUseSiteCss;
/**
* Gets group name
*
- * @return String: Name of group
+ * @return string Name of group
*/
public function getGroup() {
return 'site';
/**
* Get registration code for all modules.
*
- * @param ResourceLoaderContext $context object
+ * @param ResourceLoaderContext $context
* @return string JavaScript code for registering all modules with the client loader
*/
public static function getModuleRegistrations( ResourceLoaderContext $context ) {
*
* Detect changes to mw.config settings embedded in #getScript (bug 28899).
*
- * @param $context ResourceLoaderContext
- * @return string: Hash
+ * @param ResourceLoaderContext $context
+ * @return string Hash
*/
public function getModifiedHash( ResourceLoaderContext $context ) {
global $wgLegacyJavaScriptGlobals;
/* Methods */
/**
- * @param $context ResourceLoaderContext
- * @return array|int|Mixed
+ * @param ResourceLoaderContext $context
+ * @return array|int|mixed
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
$hash = $context->getHash();
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
public function getStyles( ResourceLoaderContext $context ) {
/* Protected Methods */
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
protected function getPages( ResourceLoaderContext $context ) {
/* Protected Methods */
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
protected function getPages( ResourceLoaderContext $context ) {
/* Methods */
/**
- * @param $context ResourceLoaderContext
- * @return array|int|Mixed
+ * @param ResourceLoaderContext $context
+ * @return array|int|mixed
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
$hash = $context->getHash();
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return string
*/
public function getScript( ResourceLoaderContext $context ) {
/**
* Fetch the tokens for the current user.
*
- * @return array: List of tokens keyed by token type
+ * @return array List of tokens keyed by token type
*/
protected function contextUserTokens() {
global $wgUser;
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return string
*/
public function getScript( ResourceLoaderContext $context ) {
* There is an optional media key, the value of which can be the
* medium ('screen', 'print', etc.) of the stylesheet.
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
abstract protected function getPages( ResourceLoaderContext $context );
}
/**
- * @param $title Title
+ * @param Title $title
* @return null|string
*/
protected function getContent( $title ) {
/* Methods */
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return string
*/
public function getScript( ResourceLoaderContext $context ) {
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
public function getStyles( ResourceLoaderContext $context ) {
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return int|mixed
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
/**
* Get the definition summary for this module.
*
- * @return Array
+ * @return array
*/
public function getDefinitionSummary( ResourceLoaderContext $context ) {
return array(
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return bool
*/
public function isKnownEmpty( ResourceLoaderContext $context ) {
/**
* Get the modification times of all titles that would be loaded for
* a given context.
- * @param $context ResourceLoaderContext: Context object
+ * @param ResourceLoaderContext $context Context object
* @return array( prefixed DB key => UNIX timestamp ), nonexistent titles are dropped
*/
protected function getTitleMtimes( ResourceLoaderContext $context ) {
var $namespaces = array( NS_MAIN );
protected $showSuggestion = true;
- /** @var Array Feature values */
+ /** @var array Feature values */
protected $features = array();
/**
* If title searches are not supported or disabled, return null.
* STUB
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SearchResultSet|Status|null
*/
function searchText( $term ) {
* If title searches are not supported or disabled, return null.
* STUB
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SearchResultSet|null
*/
function searchTitle( $term ) {
/**
* @since 1.18
- * @param $feature String
- * @return Boolean
+ * @param string $feature
+ * @return bool
*/
public function supports( $feature ) {
switch ( $feature ) {
/**
* Way to pass custom data for engines
* @since 1.18
- * @param $feature String
- * @param $data Mixed
+ * @param string $feature
+ * @param mixed $data
* @return bool
*/
public function setFeatureData( $feature, $data ) {
* If an exact title match can be found, or a very slightly close match,
* return the title. If no match, returns NULL.
*
- * @param $searchterm String
+ * @param string $searchterm
* @return Title
*/
public static function getNearMatch( $searchterm ) {
* Do a near match (see SearchEngine::getNearMatch) and wrap it into a
* SearchResultSet.
*
- * @param $searchterm string
+ * @param string $searchterm
* @return SearchResultSet
*/
public static function getNearMatchResultSet( $searchterm ) {
* Set the maximum number of results to return
* and how many to skip before returning the first.
*
- * @param $limit Integer
- * @param $offset Integer
+ * @param int $limit
+ * @param int $offset
*/
function setLimitOffset( $limit, $offset = 0 ) {
$this->limit = intval( $limit );
* Set which namespaces the search should include.
* Give an array of namespace index numbers.
*
- * @param $namespaces Array
+ * @param array $namespaces
*/
function setNamespaces( $namespaces ) {
$this->namespaces = $namespaces;
* don't support building a suggestion in the first place and others don't respect
* this flag.
*
- * @param boolean $showSuggestion should the searcher try to build suggestions
+ * @param bool $showSuggestion Should the searcher try to build suggestions
*/
function setShowSuggestion( $showSuggestion ) {
$this->showSuggestion = $showSuggestion;
* Parse some common prefixes: all (search everything)
* or namespace names
*
- * @param $query String
+ * @param string $query
* @return string
*/
function replacePrefixes( $query ) {
/**
* Make a list of searchable namespaces and their canonical names.
- * @return Array
+ * @return array
*/
public static function searchableNamespaces() {
global $wgContLang;
* Extract default namespaces to search from the given user's
* settings, returning a list of index numbers.
*
- * @param $user User
- * @return Array
+ * @param user $user
+ * @return array
*/
public static function userNamespaces( $user ) {
global $wgSearchEverythingOnlyLoggedIn;
/**
* Find snippet highlight settings for all users
*
- * @return Array contextlines, contextchars
+ * @return array Contextlines, contextchars
*/
public static function userHighlightPrefs() {
$contextlines = 2; // Hardcode this. Old defaults sucked. :)
/**
* An array of namespaces indexes to be searched by default
*
- * @return Array
+ * @return array
*/
public static function defaultNamespaces() {
global $wgNamespacesToBeSearchedDefault;
* Get a list of namespace names useful for showing in tooltips
* and preferences
*
- * @param $namespaces Array
+ * @param array $namespaces
* @return array
*/
public static function namespacesAsText( $namespaces ) {
/**
* Return the help namespaces to be shown on Special:Search
*
- * @return Array
+ * @return array
*/
public static function helpNamespaces() {
global $wgNamespacesToBeSearchedHelp;
/**
* Return a 'cleaned up' search string
*
- * @param $text String
- * @return String
+ * @param string $text
+ * @return string
*/
function filter( $text ) {
$lc = $this->legalSearchChars();
* Load up the appropriate search engine class for the currently
* active database backend, and return a configured instance.
*
- * @param String $type Type of search backend, if not the default
+ * @param string $type Type of search backend, if not the default
* @return SearchEngine
*/
public static function create( $type = null ) {
* Title and text should be pre-processed.
* STUB
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
// no-op
* Title should be pre-processed.
* STUB
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
// no-op
* Title should be pre-processed.
* STUB
*
- * @param Integer $id Page id that was deleted
- * @param String $title Title of page that was deleted
+ * @param int $id Page id that was deleted
+ * @param string $title Title of page that was deleted
*/
function delete( $id, $title ) {
// no-op
/**
* Get OpenSearch suggestion template
*
- * @return String
+ * @return string
*/
public static function getOpenSearchTemplate() {
global $wgOpenSearchTemplate, $wgCanonicalServer;
/**
* Default implementation of wikitext highlighting
*
- * @param $text String
- * @param array $terms terms to highlight (unescaped)
- * @param $contextlines Integer
- * @param $contextchars Integer
- * @return String
+ * @param string $text
+ * @param array $terms Terms to highlight (unescaped)
+ * @param int $contextlines
+ * @param int $contextchars
+ * @return tring
*/
public function highlightText( $text, $terms, $contextlines, $contextchars ) {
global $wgContLang;
* Split text into lines and add it to extracts array
*
* @param array $extracts index -> $line
- * @param $count Integer
- * @param $text String
+ * @param int $count
+ * @param string $text
*/
function splitAndAdd( &$extracts, &$count, $text ) {
$split = explode( "\n", $this->mCleanWikitext ? $this->removeWiki( $text ) : $text );
/**
* Do manual case conversion for non-ascii chars
*
- * @param $matches Array
+ * @param array $matches
* @return string
*/
function caseCallback( $matches ) {
/**
* Extract part of the text from start to end, but by
* not chopping up words
- * @param $text String
- * @param $start Integer
- * @param $end Integer
- * @param $posStart Integer: (out) actual start position
- * @param $posEnd Integer: (out) actual end position
- * @return String
+ * @param string $text
+ * @param int $start
+ * @param int $end
+ * @param int $posStart (out) actual start position
+ * @param int $posEnd (out) actual end position
+ * @return string
*/
function extract( $text, $start, $end, &$posStart = null, &$posEnd = null ) {
if ( $start != 0 ) {
/**
* Find a nonletter near a point (index) in the text
*
- * @param $text String
- * @param $point Integer
- * @param $offset Integer: offset to found index
- * @return Integer: nearest nonletter index, or beginning of utf8 char if none
+ * @param string $text
+ * @param int $point
+ * @param int $offset Offset to found index
+ * @return int Nearest nonletter index, or beginning of utf8 char if none
*/
function position( $text, $point, $offset = 0 ) {
$tolerance = 10;
/**
* Search extracts for a pattern, and return snippets
*
- * @param string $pattern regexp for matching lines
- * @param array $extracts extracts to search
- * @param $linesleft Integer: number of extracts to make
- * @param $contextchars Integer: length of snippet
- * @param array $out map for highlighted snippets
- * @param array $offsets map of starting points of snippets
+ * @param string $pattern Regexp for matching lines
+ * @param array $extracts Extracts to search
+ * @param int $linesleft Number of extracts to make
+ * @param int $contextchars Length of snippet
+ * @param array $out Map for highlighted snippets
+ * @param array $offsets Map of starting points of snippets
* @protected
*/
function process( $pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets ) {
* callback to replace [[target|caption]] kind of links, if
* the target is category or image, leave it
*
- * @param $matches Array
+ * @param array $matches
*/
function linkReplace( $matches ) {
$colon = strpos( $matches[1], ':' );
* Simple & fast snippet extraction, but gives completely unrelevant
* snippets
*
- * @param $text String
- * @param $terms Array
- * @param $contextlines Integer
- * @param $contextchars Integer
- * @return String
+ * @param string $text
+ * @param array $terms
+ * @param int $contextlines
+ * @param int $contextchars
+ * @return string
*/
public function highlightSimple( $text, $terms, $contextlines, $contextchars ) {
global $wgContLang;
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MssqlSearchResultSet
* @access public
*/
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MssqlSearchResultSet
* @access public
*/
/**
* Return a partial WHERE clause to limit the search to the given namespaces
*
- * @return String
+ * @return string
* @private
*/
function queryNamespaces() {
/**
* Return a LIMIT clause to limit results on the query.
*
- * @param $sql string
+ * @param string $sql
*
- * @return String
+ * @return string
*/
function queryLimit( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
* Does not do anything for generic search engine
* subclasses may define this though
*
- * @return String
+ * @return string
*/
function queryRanking( $filteredTerm, $fulltext ) {
return ' ORDER BY ftindex.[RANK] DESC'; // return ' ORDER BY score(1)';
* Construct the full SQL query to do the search.
* The guts shoulds be constructed in queryMain()
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
/**
* Picks which field to index on, depending on what type of query.
*
- * @param $fulltext Boolean
+ * @param bool $fulltext
* @return string
*/
function getIndexField( $fulltext ) {
/**
* Get the base part of the search query.
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
* @private
*/
function queryMain( $filteredTerm, $fulltext ) {
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
* @return bool|ResultWrapper
*/
function update( $id, $title, $text ) {
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
* @return bool|ResultWrapper
*/
function updateTitle( $id, $title ) {
* Parse the user's query and transform it into an SQL fragment which will
* become part of a WHERE clause
*
- * @param $filteredText string
- * @param $fulltext string
+ * @param string $filteredText
+ * @param string $fulltext
*
* @return string
*/
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MySQLSearchResultSet
*/
function searchText( $term ) {
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MySQLSearchResultSet
*/
function searchTitle( $term ) {
/**
* Add special conditions
- * @param $query Array
+ * @param array $query
* @since 1.18
*/
protected function queryFeatures( &$query ) {
/**
* Add namespace conditions
- * @param $query Array
+ * @param array $query
* @since 1.18 (changed)
*/
function queryNamespaces( &$query ) {
/**
* Add limit options
- * @param $query Array
+ * @param array $query
* @since 1.18
*/
protected function limitResult( &$query ) {
/**
* Construct the SQL query to do the search.
* The guts shoulds be constructed in queryMain()
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return Array
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return array
* @since 1.18 (changed)
*/
function getQuery( $filteredTerm, $fulltext ) {
/**
* Picks which field to index on, depending on what type of query.
- * @param $fulltext Boolean
- * @return String
+ * @param bool $fulltext
+ * @return string
*/
function getIndexField( $fulltext ) {
return $fulltext ? 'si_text' : 'si_title';
/**
* Get the base part of the search query.
*
- * @param &$query array Search query array
- * @param $filteredTerm String
- * @param $fulltext Boolean
+ * @param array &$query Search query array
+ * @param string $filteredTerm
+ * @param bool $fulltext
* @since 1.18 (changed)
*/
function queryMain( &$query, $filteredTerm, $fulltext ) {
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
$dbw = wfGetDB( DB_MASTER );
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
$dbw = wfGetDB( DB_MASTER );
* Delete an indexed page
* Title should be pre-processed.
*
- * @param Integer $id Page id that was deleted
- * @param String $title Title of page that was deleted
+ * @param int $id Page id that was deleted
+ * @param string $title Title of page that was deleted
*/
function delete( $id, $title ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqlSearchResultSet
*/
function searchText( $term ) {
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqlSearchResultSet
*/
function searchTitle( $term ) {
/**
* Return a partial WHERE clause to limit the search to the given namespaces
- * @return String
+ * @return string
*/
function queryNamespaces() {
if ( is_null( $this->namespaces ) ) {
/**
* Return a LIMIT clause to limit results on the query.
*
- * @param $sql string
+ * @param string $sql
*
- * @return String
+ * @return string
*/
function queryLimit( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
* Does not do anything for generic search engine
* subclasses may define this though
*
- * @return String
+ * @return string
*/
function queryRanking( $filteredTerm, $fulltext ) {
return ' ORDER BY score(1)';
/**
* Construct the full SQL query to do the search.
* The guts shoulds be constructed in queryMain()
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
/**
* Picks which field to index on, depending on what type of query.
- * @param $fulltext Boolean
- * @return String
+ * @param bool $fulltext
+ * @return string
*/
function getIndexField( $fulltext ) {
return $fulltext ? 'si_text' : 'si_title';
/**
* Get the base part of the search query.
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function queryMain( $filteredTerm, $fulltext ) {
$match = $this->parseQuery( $filteredTerm, $fulltext );
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
$dbw = wfGetDB( DB_MASTER );
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
$dbw = wfGetDB( DB_MASTER );
* Currently searches a page's current title (page.page_title) and
* latest revision article text (pagecontent.old_text)
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return PostgresSearchResultSet
*/
function searchTitle( $term ) {
* Transform the user's search string into a better form for tsearch2
* Returns an SQL fragment consisting of quoted text to search for.
*
- * @param $term string
+ * @param string $term
*
* @return string
*/
/**
* Construct the full SQL query to do the search.
- * @param $term String
- * @param $fulltext String
- * @param $colname
+ * @param string $term
+ * @param string $fulltext
+ * @param string $colname
* @return string
*/
function searchQuery( $term, $fulltext, $colname ) {
protected $mTitle;
/**
- * @var String
+ * @var string
*/
protected $mText;
/**
* Return a new SearchResult and initializes it with a title.
*
- * @param $title Title
+ * @param Title $title
* @return SearchResult
*/
public static function newFromTitle( $title ) {
/**
* Return a new SearchResult and initializes it with a row.
*
- * @param $row object
+ * @param object $row
* @return SearchResult
*/
public static function newFromRow( $row ) {
* Initialize from a database row. Makes a Title and passes that to
* initFromTitle.
*
- * @param $row object
+ * @param object $row
*/
protected function initFromRow( $row ) {
$this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) );
* Initialize from a Title and if possible initializes a corresponding
* Revision and File.
*
- * @param $title Title
+ * @param Title $title
*/
protected function initFromTitle( $title ) {
$this->mTitle = $title;
/**
* Check if this is result points to an invalid title
*
- * @return Boolean
+ * @return bool
*/
function isBrokenTitle() {
return is_null( $this->mTitle );
/**
* Check if target page is missing, happens when index is out of date
*
- * @return Boolean
+ * @return bool
*/
function isMissingRevision() {
return !$this->mRevision && !$this->mImage;
}
/**
- * @return float|null if not supported
+ * @return float|null If not supported
*/
function getScore() {
return null;
}
/**
- * @param array $terms terms to highlight
- * @return String: highlighted text snippet, null (and not '') if not supported
+ * @param array $terms Terms to highlight
+ * @return string Highlighted text snippet, null (and not '') if not supported
*/
function getTextSnippet( $terms ) {
global $wgAdvancedSearchHighlighting;
}
/**
- * @return String: highlighted title, '' if not supported
+ * @return string Highlighted title, '' if not supported
*/
function getTitleSnippet() {
return '';
}
/**
- * @return String: highlighted redirect name (redirect to this page), '' if none or not supported
+ * @return string Highlighted redirect name (redirect to this page), '' if none or not supported
*/
function getRedirectSnippet() {
return '';
}
/**
- * @return Title object for the redirect to this page, null if none or not supported
+ * @return Title Title object for the redirect to this page, null if none or not supported
*/
function getRedirectTitle() {
return null;
}
/**
- * @return string highlighted relevant section name, null if none or not supported
+ * @return string Highlighted relevant section name, null if none or not supported
*/
function getSectionSnippet() {
return '';
}
/**
- * @return Title object (pagename+fragment) for the section, null if none or not supported
+ * @return Title Title object (pagename+fragment) for the section, null if none or not supported
*/
function getSectionTitle() {
return null;
}
/**
- * @return String: timestamp
+ * @return string timestamp
*/
function getTimestamp() {
if ( $this->mRevision ) {
}
/**
- * @return Integer: number of words
+ * @return int Number of words
*/
function getWordCount() {
$this->initText();
}
/**
- * @return Integer: size in bytes
+ * @return int Size in bytes
*/
function getByteSize() {
$this->initText();
}
/**
- * @return Boolean if hit has related articles
+ * @return bool If hit has related articles
*/
function hasRelated() {
return false;
}
/**
- * @return String: interwiki prefix of the title (return iw even if title is broken)
+ * @return string Interwiki prefix of the title (return iw even if title is broken)
*/
function getInterwikiPrefix() {
return '';
}
/**
- * @return string interwiki namespace of the title (since we likely can't resolve it locally)
+ * @return string Interwiki namespace of the title (since we likely can't resolve it locally)
*/
function getInterwikiNamespaceText() {
return '';
/**
* Did this match file contents (eg: PDF/DJVU)?
+ * @return bool
*/
function isFileMatch() {
return false;
* the search terms as parsed by this engine in a text extract.
* STUB
*
- * @return Array
+ * @return array
*/
function termMatches() {
return array();
* Return true if results are included in this result set.
* STUB
*
- * @return Boolean
+ * @return bool
*/
function hasResults() {
return false;
*
* Return null if no total hits number is supported.
*
- * @return Integer
+ * @return int
*/
function getTotalHits() {
return null;
* Some search modes return a suggested alternate term if there are
* no exact hits. Returns true if there is one on this set.
*
- * @return Boolean
+ * @return bool
*/
function hasSuggestion() {
return false;
}
/**
- * @return String: suggested query, null if none
+ * @return string Suggested query, null if none
*/
function getSuggestionQuery() {
return null;
}
/**
- * @return String: HTML highlighted suggested query, '' if none
+ * @return string HTML highlighted suggested query, '' if none
*/
function getSuggestionSnippet() {
return '';
/**
* Check if there are results on other wikis
*
- * @return Boolean
+ * @return bool
*/
function hasInterwikiResults() {
return $this->getInterwikiResults() != null;
* Did the search contain search syntax? If so, Special:Search won't offer
* the user a link to a create a page named by the search string because the
* name would contain the search syntax.
+ * @return bool
*/
public function searchContainedSyntax() {
return false;
private $fetched = false;
/**
- * @param $match mixed Title if matched, else null
+ * @param Title|null $match Title if matched, else null
*/
public function __construct( $match ) {
$this->result = $match;
class SearchSqlite extends SearchDatabase {
/**
* Whether fulltext search is supported by current schema
- * @return Boolean
+ * @return bool
*/
function fulltextSearchSupported() {
return $this->db->checkForEnabledSearch();
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqliteSearchResultSet
*/
function searchText( $term ) {
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqliteSearchResultSet
*/
function searchTitle( $term ) {
/**
* Return a partial WHERE clause to limit the search to the given namespaces
- * @return String
+ * @return string
*/
function queryNamespaces() {
if ( is_null( $this->namespaces ) ) {
/**
* Returns a query with limit for number of results set.
- * @param $sql String:
- * @return String
+ * @param string $sql
+ * @return string
*/
function limitResult( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
/**
* Construct the full SQL query to do the search.
* The guts shoulds be constructed in queryMain()
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->limitResult(
/**
* Picks which field to index on, depending on what type of query.
- * @param $fulltext Boolean
- * @return String
+ * @param bool $fulltext
+ * @return string
*/
function getIndexField( $fulltext ) {
return $fulltext ? 'si_text' : 'si_title';
/**
* Get the base part of the search query.
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function queryMain( $filteredTerm, $fulltext ) {
$match = $this->parseQuery( $filteredTerm, $fulltext );
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
if ( !$this->fulltextSearchSupported() ) {
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
if ( !$this->fulltextSearchSupported() ) {