mirror of
https://github.com/danog/phpdoc.git
synced 2024-11-26 12:04:47 +01:00
Add separate signature anchor method
This commit is contained in:
parent
1c410ad894
commit
6130ea30c5
@ -122,13 +122,24 @@ class MethodDoc extends GenericDoc
|
||||
* @return string
|
||||
*/
|
||||
public function getSignatureLink(): string
|
||||
{
|
||||
$sig = $this->getSignature();
|
||||
$sigLink = $this->getSignatureAnchor();
|
||||
return "[`$sig`](#$sigLink)";
|
||||
}
|
||||
/**
|
||||
* Get method signature link.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSignatureAnchor(): string
|
||||
{
|
||||
$sig = $this->getSignature();
|
||||
$sigLink = strtolower($sig);
|
||||
$sigLink = preg_replace('/[^\w ]+/', ' ', $sigLink);
|
||||
$sigLink = preg_replace('/ +/', ' ', $sigLink);
|
||||
$sigLink = str_replace(' ', '-', $sigLink);
|
||||
return "[`$sig`](#$sigLink)";
|
||||
return $sigLink;
|
||||
}
|
||||
/**
|
||||
* Generate markdown for method.
|
||||
|
Loading…
Reference in New Issue
Block a user