/** * @param string $vendor * @param string $package * @param string $category * @param string $message * @param string $version */ private function __construct($vendor, $package, $category, $message, $version) { $this->vendor = $vendor; $this->package = $package; $this->category = $category ?: null; $this->message = $message; $this->version = SchemaVersion::fromString($version); $this->id = sprintf('pbj:%s:%s:%s:%s:%s', $this->vendor, $this->package, $this->category, $this->message, $this->version->toString()); }
/** * Returns -1 if the current version is lower than the second, 0 if they are equal, * and 1 if the second is lower. * * @param SchemaVersion $version * * @return int */ public function compare(SchemaVersion $version) { return version_compare($this->toString(), $version->toString()); }