You are here

class dba_report_version in Database Administration 7

Class for comparing version.

Hierarchy

Expanded class hierarchy of dba_report_version

File

./dba.report.inc, line 159

View source
class dba_report_version {
  public $major;
  public $minor;
  public $patch;
  public function __construct($major = 0, $minor = 0, $patch = 0) {
    $this->major = $major;
    $this->minor = $minor;
    $this->patch = $patch;
  }
  public function __toString() {
    return sprintf('%02d%02d%02d', $this->major, $this->minor, $this->patch);
  }
  public function compare_version($version, $operation = '==') {
    $current = $this
      ->__toString();
    $compare = $version
      ->__toString();
    $comparison = 'return $current' . $operation . '$compare;';
    return eval($comparison);
  }

}

Members