Class PelEntrySRational

Description

Class for holding signed rational numbers.

This class can hold rational numbers, consisting of a numerator and denominator both of which are of type unsigned long. Each rational is represented by an array with just two entries: the numerator and the denominator, in that order.

The class can hold either just a single rational or an array of rationals. The class will be used to manipulate any of the Exif tags which can have format PelFormat::SRATIONAL.

Located in /src/PelEntryRational.php (line 193)

PelEntry
   |
   --PelEntryNumber
      |
      --PelEntrySLong
         |
         --PelEntrySRational
Method Summary
PelEntrySRational __construct (PelTag $tag, array $value...)
string formatNumber (array $number, [boolean $brief = false])
string getText ([boolean $brief = false])
Variables
Methods
Constructor __construct (line 211)

Make a new entry that can hold a signed rational.

PelEntrySRational __construct (PelTag $tag, array $value...)
  • array $value...: the rational(s) that this entry will represent. The arguments passed must obey the same rules as the argument to setValue, namely that each argument should be an array with two entries, both of which must be within range of a signed long (32 bit), that is between -2147483648 and 2147483647 (inclusive). If not, then a PelOverflowException will be thrown.
  • PelTag $tag: the tag which this entry represents. This should be one of the constants defined in PelTag, e.g., PelTag::SHUTTER_SPEED_VALUE, or any other tag which can have format PelFormat::SRATIONAL.

Redefinition of:
PelEntrySLong::__construct()
Make a new entry that can hold a signed long.
formatNumber (line 238)

Format a rational number.

The rational will be returned as a string with a slash '/' between the numerator and denominator. Care is taken to display '-1/2' instead of the ugly but mathematically equivalent '1/-2'.

  • return: the rational formatted as a string suitable for display.
string formatNumber (array $number, [boolean $brief = false])
  • array $number: the rational which will be formatted.
  • boolean $brief: not used.

Redefinition of:
PelEntryNumber::formatNumber()
Format a number.
getText (line 259)

Get the value of an entry as text.

The value will be returned in a format suitable for presentation, e.g., rationals will be returned as 'x/y', ASCII strings will be returned as themselves etc.

  • return: the value as text.
string getText ([boolean $brief = false])
  • boolean $brief: some values can be returned in a long or more brief form, and this parameter controls that.

Redefinition of:
PelEntryNumber::getText()
Get the numeric value of this entry as text.

Inherited Methods

Inherited From PelEntrySLong

PelEntrySLong::__construct()
PelEntrySLong::numberToBytes()

Inherited From PelEntryNumber

PelEntryNumber::addNumber()
PelEntryNumber::formatNumber()
PelEntryNumber::getBytes()
PelEntryNumber::getText()
PelEntryNumber::getValue()
PelEntryNumber::numberToBytes()
PelEntryNumber::setValue()
PelEntryNumber::setValueArray()
PelEntryNumber::validateNumber()

Inherited From PelEntry

PelEntry::getBytes()
PelEntry::getComponents()
PelEntry::getFormat()
PelEntry::getIfdType()
PelEntry::getTag()
PelEntry::getText()
PelEntry::getValue()
PelEntry::setIfdType()
PelEntry::setValue()
PelEntry::__toString()

Documentation generated on Thu, 05 May 2011 07:19:05 +0200 by phpDocumentor 1.4.3