本文整理汇总了PHP中Link::getDestination方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::getDestination方法的具体用法?PHP Link::getDestination怎么用?PHP Link::getDestination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::getDestination方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isPhpClass
private function isPhpClass(Link $link)
{
$className = $link->getDestination();
if (!class_exists($className, false)) {
return false;
}
$classReflection = new \ReflectionClass($link->getDestination());
return $classReflection->isInternal();
}
示例2: formatInternalMethod
private function formatInternalMethod(Link $link)
{
if (empty($this->scope->class)) {
return;
}
$methodName = substr($link->getDestination(), 0, strlen($link->getDestination()) - 2);
$methods = $this->scope->class->getMethods(true);
if (empty($methodName) || !array_key_exists($methodName, $methods)) {
return;
}
$linkToClass = $this->getLinkToApiClass($this->scope->class->getName());
return sprintf('[%s](%s#%s)', $link->getDescription(), $linkToClass, strtolower($methodName));
}
示例3: logUnresolvedLink
private function logUnresolvedLink(Link $link)
{
$blacklist = array('array', 'string', 'mixed', 'int', 'integer', 'bool');
if (in_array($link->getDestination(), $blacklist)) {
return;
}
$message = 'Unresolved link: "' . $link->getDestination() . '"';
if (empty($this->scope->class) && $this->scope->namespace) {
$message .= ' in Namespace ' . $this->scope->namespace;
} elseif (!empty($this->scope->class)) {
$message .= ' in Class ' . $this->scope->class;
}
error_log($message);
}
示例4: formatApiClass
private function formatApiClass(Link $link)
{
$linkToClass = $this->getLinkToApiClass($link->getDestination());
if (empty($linkToClass)) {
return;
}
$description = $link->getDescription();
$parts = explode("\\", $description);
$description = end($parts);
$link = sprintf('[%s](%s)', $description, $linkToClass);
return $link;
}
示例5: formatInternalProperty
private function formatInternalProperty(Link $link)
{
if (empty($this->scope->class)) {
return;
}
$properties = $this->scope->class->getProperties(true);
$propertyName = substr($link->getDestination(), 1);
if (!$propertyName || !array_key_exists($propertyName, $properties)) {
return;
}
$linkToClass = $this->getLinkToApiClass($this->scope->class->getName());
return sprintf('[%s](%s#$%s)', $link->getDescription(), $linkToClass, strtolower($propertyName));
}
示例6: parse
public function parse($comment)
{
if (preg_match_all('/{\\@link(.*?)}/', $comment, $matches)) {
foreach ($matches[0] as $key => $rawLink) {
$linkParser = new LinkParser($this->scope);
$linkFormatted = $linkParser->parse($matches[1][$key]);
$comment = str_replace($rawLink, $linkFormatted, $comment);
}
}
if (preg_match_all('/{\\@hook(.*?)}/', $comment, $matches)) {
foreach ($matches[0] as $key => $rawLink) {
$link = new Link($matches[1][$key]);
$anchor = strtolower(str_replace('.', '', $link->getDestination()));
$linkFormatted = sprintf('[%s](/api-reference/events#%s)', $link->getDescription(), $anchor);
$comment = str_replace($rawLink, $linkFormatted, $comment);
}
}
return $comment;
}
示例7: formatInternalConstant
private function formatInternalConstant(Link $link)
{
$constName = $link->getDestination();
if (empty($this->scope->class) || empty($constName)) {
return;
}
$constants = $this->scope->class->getConstants(true);
if (!array_key_exists($constName, $constants)) {
return;
}
$constant = $constants[$constName];
if (!$constant) {
return;
}
$description = $link->getDescription();
if ($constant->getLongDesc()) {
// we are displaying a link only to constants having a long description.
$linkToClass = $this->getLinkToApiClass($this->scope->class->getName());
return sprintf('`[%s](%s#%s)`', $description, $linkToClass, strtolower($constant));
}
return sprintf('`%s`', $description);
}
示例8: parseLinkToExternalClass
protected function parseLinkToExternalClass(Link $link)
{
return explode('::', $link->getDestination());
}
示例9: formatting
public function formatting(Link $link)
{
return $this->formatExternalLink($link->getDestination(), $link->getDescription());
}
示例10: addLink
public function addLink(Link $link)
{
$linkID = $this->getLinkID($link->getSource(), $link->getDestination());
$this->links[$linkID] = $link;
}