public static function buildFromCommitMessage(CommitMessage $commitMessage) { $actionTag = $commitMessage->getVersionPressTag(TrackedChangeInfo::ACTION_TAG); $pluginName = $commitMessage->getVersionPressTag(self::PLUGIN_NAME_TAG); list(, $action, $pluginFile) = explode("/", $actionTag, 3); return new self($pluginFile, $action, $pluginName); }
public static function buildFromCommitMessage(CommitMessage $commitMessage) { $actionTag = $commitMessage->getVersionPressTag(TrackedChangeInfo::ACTION_TAG); $themeName = $commitMessage->getVersionPressTag(self::THEME_NAME_TAG); list(, $action, $themeId) = explode("/", $actionTag, 3); return new self($themeId, $action, $themeName); }
public static function buildFromCommitMessage(CommitMessage $commitMessage) { $actionTag = $commitMessage->getVersionPressTag(TrackedChangeInfo::ACTION_TAG); $languageCode = $commitMessage->getVersionPressTag(self::LANGUAGE_CODE_TAG); $languageName = $commitMessage->getVersionPressTag(self::LANGUAGE_NAME_TAG); $type = $commitMessage->getVersionPressTag(self::TRANSLATION_TYPE_TAG); $name = $commitMessage->getVersionPressTag(self::TRANSLATION_NAME_TAG); list(, $action) = explode("/", $actionTag, 2); return new self($action, $languageCode, $languageName, $type, $name); }
/** * Returns matching ChangeInfo type for a given commit message. Matching is done based on the value of the VP-Action tag. * * @param CommitMessage $commitMessage * @throws Exception When no matching ChangeInfo type is found (should never happen) * @return string "Class" of the matching ChangeInfo object */ public static function findMatchingChangeInfo(CommitMessage $commitMessage) { if (substr_count($commitMessage->getBody(), TrackedChangeInfo::ACTION_TAG) > 1) { return "VersionPress\\ChangeInfos\\ChangeInfoEnvelope"; } $actionTagValue = $commitMessage->getVersionPressTag(TrackedChangeInfo::ACTION_TAG); // can be empty string which is not a problem foreach (self::$changeInfoMap as $actionTagExpression => $changeInfoType) { $regex = "~^" . $actionTagExpression . "\$~"; if (preg_match($regex, $actionTagValue)) { return $changeInfoType; } } // Code execution should never reach this point, at least the 'UntrackedChangeInfo' should match throw new Exception("Matching ChangeInfo type not found"); }
public static function buildFromCommitMessage(CommitMessage $commitMessage) { $actionTag = $commitMessage->getVersionPressTag(TrackedChangeInfo::ACTION_TAG); list(, $action, $versionPressVersion) = array_pad(explode("/", $actionTag, 3), 3, ""); return new self($action, $versionPressVersion); }
private static function extractTag($tag, $commitMessageBody) { $tmpMessage = new CommitMessage("", $commitMessageBody); return $tmpMessage->getVersionPressTag($tag); }
private static function extractVersion($lastBody) { $tmpMessage = new CommitMessage("", $lastBody); $version = $tmpMessage->getVersionPressTag(self::VP_VERSION_TAG); return $version; }