dmBridge PHP API
DMRating Class Reference

Represents an individual rating that a user has given to an object. More...

Inheritance diagram for DMRating:

Public Member Functions


Detailed Description

Represents an individual rating that a user has given to an object.

Conceptually/semantically, a rating can also mean some sort of overall calculation on all of the object's combined ratings (such as mean, median, etc.); for this, use DMObject::getRating().

Author:
Alex Dolski <alex.dolski@unlv.edu> http://www.opensource.org/licenses/mit-license.php

Definition at line 18 of file DMRating.php.


Constructor & Destructor Documentation

DMRating::__construct ( value,
max 
)

A rating value has no meaning without a scale: 1 out of 5, 8 out of 10, etc.

This constructor takes a value and the max value of the scale. Ratings are transparently normalized to a scale of 0-100 for storage.

Parameters:
intvalue
intmax
Exceptions:
DMIllegalArgumentException

Definition at line 32 of file DMRating.php.


Member Function Documentation

DMRating::__toString ( )

Returns the rating's value as a string, rounded to 2 decimal places.

Do not depend on this method, as it is not guaranteed to be stable; DMRating::getValue() is more precise and preferred.

Returns:
string
See also:
DMRating::getValue()

Reimplemented from DMAbstractSocialEntity.

Definition at line 51 of file DMRating.php.

DMRating::getMax ( ) [final]
Returns:
float The largest value of the rating scale

Definition at line 58 of file DMRating.php.

Referenced by getNormalizedValue().

DMRating::getNormalizedValue ( ) [final]

Normalizes the rating to a scale of 0-100 for storage.

Returns:
float

Definition at line 80 of file DMRating.php.

Referenced by DMPDODataStore::addObjectRating().

DMRating::getURI ( )

Exists to comply with DMSocialEntity.

Currently doesn't do anything.

Returns:
null

Definition at line 89 of file DMRating.php.

DMRating::setMax ( max) [final]
Parameters:
floatmax A positive number
Exceptions:
DMIllegalArgumentException

Definition at line 66 of file DMRating.php.

Referenced by __construct().

DMRating::setValue ( float)
Parameters:
floatfloat
Exceptions:
DMIllegalArgumentException

Reimplemented from DMAbstractSocialEntity.

Definition at line 97 of file DMRating.php.

Referenced by __construct().


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