/** * Convenience method to return the name of the method that should * exist to handle this message. * * For example, an ImportUserV1 message would be handled by: * SomeClass::importUserV1(ImportUserV1 $command) * * @param bool $withMajor * @return string */ public function getHandlerMethodName($withMajor = true) { if (true === $withMajor) { return lcfirst($this->classShortName); } return lcfirst(str_replace('V' . $this->id->getVersion()->getMajor(), '', $this->classShortName)); }
/** * @param SchemaId $id * @return SchemaCurie */ public static function fromId(SchemaId $id) { $curie = substr(str_replace(':' . $id->getVersion()->toString(), '', $id->toString()), 4); if (isset(self::$instances[$curie])) { return self::$instances[$curie]; } self::$instances[$curie] = new self($id->getVendor(), $id->getPackage(), $id->getCategory(), $id->getMessage()); return self::$instances[$curie]; }