Semantic MediaWiki and related extensions
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SMW\MediaWiki\Api\ApiQueryResultFormatter Class Reference

Public Member Functions

 __construct (SMWQueryResult $queryResult)
 
 setIsRawMode ($isRawMode)
 
 getContinueOffset ()
 
 getType ()
 
 getResult ()
 
 doFormat ()
 
 setIndexedTagName (&$arr, $tag=null)
 

Protected Member Functions

 formatResults (array $queryResult)
 
 formatErrors (array $errors)
 

Protected Attributes

 $continueOffset = false
 
 $type
 
 $isRawMode = false
 

Detailed Description

This class handles the Api related query result formatting

GNU GPL v2+

Since
1.9
Author
mwjames

Constructor & Destructor Documentation

SMW\MediaWiki\Api\ApiQueryResultFormatter::__construct ( SMWQueryResult  $queryResult)
Since
1.9
Parameters
SMWQueryResult$queryResult

Member Function Documentation

SMW\MediaWiki\Api\ApiQueryResultFormatter::doFormat ( )

Result formatting

Since
1.9
SMW\MediaWiki\Api\ApiQueryResultFormatter::formatErrors ( array  $errors)
protected

Formatting an error array in order to support JSON/XML

Since
1.9
Parameters
array$errors
Returns
array
SMW\MediaWiki\Api\ApiQueryResultFormatter::formatResults ( array  $queryResult)
protected

Formatting a result array to support JSON/XML standards

Since
1.9
Parameters
array$queryResult
Returns
array
SMW\MediaWiki\Api\ApiQueryResultFormatter::getContinueOffset ( )

Returns an offset used for continuation support

Since
1.9
Returns
integer
SMW\MediaWiki\Api\ApiQueryResultFormatter::getResult ( )

Returns formatted result

Since
1.9
Returns
array
SMW\MediaWiki\Api\ApiQueryResultFormatter::getType ( )

Returns the result type

Since
1.9
Returns
string
SMW\MediaWiki\Api\ApiQueryResultFormatter::setIndexedTagName ( $arr,
  $tag = null 
)

Add '_element' to an array

Note
Copied from ApiResult::setIndexedTagName to avoid having a constructor injection in order to be able to access this method
See also
ApiResult::setIndexedTagName
Since
1.9
Parameters
array&$arr
string$tag
SMW\MediaWiki\Api\ApiQueryResultFormatter::setIsRawMode (   $isRawMode)

Sets whether the formatter requested raw data and is used in connection with ApiQueryResultFormatter::setIndexedTagName

See also
ApiResult::getIsRawMode
Since
1.9
Parameters
boolean$isRawMode

Member Data Documentation

SMW\MediaWiki\Api\ApiQueryResultFormatter::$continueOffset = false
protected
SMW\MediaWiki\Api\ApiQueryResultFormatter::$isRawMode = false
protected
SMW\MediaWiki\Api\ApiQueryResultFormatter::$type
protected

The documentation for this class was generated from the following file: