/** * Get changelog path * * @param Version $version * @return string */ public function getChangelogPath(Version $version) { $cowData = $this->getCowData(); // If generating via markdown committed to source control if (empty($cowData['changelog-path'])) { return null; } $path = Format::formatString($cowData['changelog-path'], ['stability' => $version->getStability(), 'stabilityVersion' => $version->getStabilityVersion(), 'major' => $version->getMajor(), 'minor' => $version->getMinor(), 'patch' => $version->getPatch(), 'version' => $version->getValue(), 'versionStable' => $version->getValueStable()]); // Collapse duplicate // return str_replace('//', '/', $path); }
/** * Get markdown content for this line item, including end of line * * @param string $format Format for line * @param string $securityFormat Format for security CVE link * @return string */ public function getMarkdown($format = null, $securityFormat = null) { if (!isset($format)) { $format = ' * {date} [{shortHash}]({link}) {shortMessage} ({author})'; } $content = Format::formatString($format, ['type' => $this->getType(), 'link' => $this->getLink(), 'shortHash' => $this->getShortHash(), 'date' => $this->getDate()->format('Y-m-d'), 'rawMessage' => $this->getRawMessage(), 'message' => $this->getMessage(), 'shortMessage' => $this->getShortMessage(), 'author' => $this->getAuthor()]); // Append security identifier if ($cve = $this->getSecurityCVE()) { if (!isset($securityFormat)) { $securityFormat = ' - See [{cve}]({cveURL})'; } $content .= Format::formatString($securityFormat, ['cve' => $cve, 'cveURL' => $this->cveURL . $cve]); } return $content . "\n"; }