Stack.PHP
A simple and easy to use PHP library for the Stack Exchange API.
Public Member Functions | Static Public Attributes
Filter Class Reference

Represents a filter for data returned in the response. More...

List of all members.

Public Member Functions

 __construct ($filter_id=null)
 Constructor for a Filter object.
 GetID ()
 Returns an ID for the filter, retrieving one if it does not exist.
 SetID ($filter_id)
 Sets the filter ID.
 GetIncludeItems ()
 Retrieves the items that are to be included in the filter.
 SetIncludeItems ($items)
 Includes the specified items in the filter.
 SetExcludeItems ($items)
 Excludes the specified items from the filter.
 GetUnsafe ()
 Returns whether this filter should return HTML-safe content.
 SetUnsafe ($unsafe=TRUE)
 Indicates whether the responses returned should be HTML-safe.

Static Public Attributes

static $default_filter = 'default'
 The filter used by default when pagination data is not needed.
static $default_pagination_filter = '!DnBO_'
 The filter used by default when pagination data is required.

Detailed Description

Represents a filter for data returned in the response.

A filter allows you to decide what content is provided in the response that the API returns. You can choose specific data that you would like returned and specific data you would like omitted.

By default, Stack.PHP uses a filter that is similar to the default filter with the addition of the remaining .wrapper properties. Stack.PHP may run into trouble stepping through paged data if you enable a filter that does not provide this data - however, if you do not need paged data, you may see a speed increase by omitting this data.

You can change the default filter by setting API::$filter.


Constructor & Destructor Documentation

Filter::__construct ( filter_id = null)

Constructor for a Filter object.

Parameters:
$filter_idthe ID of an existing filter

Member Function Documentation

Filter::GetID ( )

Returns an ID for the filter, retrieving one if it does not exist.

Returns:
the ID for the filter
Filter::GetIncludeItems ( )

Retrieves the items that are to be included in the filter.

Returns:
an array of items to be included
Filter::GetUnsafe ( )

Returns whether this filter should return HTML-safe content.

Returns:
TRUE if this filter returns unsafe data
Filter::SetExcludeItems ( items)

Excludes the specified items from the filter.

Parameters:
$itemseither a single item or an array of items
Returns:
the current instance

Note: if this filter already possesses an ID, it will be discarded because it will no longer be valid after the new items are added.

Filter::SetID ( filter_id)

Sets the filter ID.

Parameters:
$filter_idthe ID of the filter
Returns:
the current instance

Note: if this filter already possesses an ID, its stored data will be discarded since it will not be valid for the current filter.

Filter::SetIncludeItems ( items)

Includes the specified items in the filter.

Parameters:
$itemseither a single item or an array of items
Returns:
the current instance

Note: if this filter already possesses an ID, it will be discarded because it will no longer be valid after the new items are added.

Filter::SetUnsafe ( unsafe = TRUE)

Indicates whether the responses returned should be HTML-safe.

Parameters:
$unsafeTRUE to return unsafe responses
Returns:
the current instance

Note: if this filter already possesses an ID, it will be discarded because it will no longer be valid after this parameter is set.


The documentation for this class was generated from the following file:
 All Classes Functions Variables