ApiGen\Templating\Filters\Helpers\ElementUrlFactory::createForConstant PHP Метод

createForConstant() публичный метод

public createForConstant ( ApiGen\Contracts\Parser\Reflection\ConstantReflectionInterface $constant ) : string
$constant ApiGen\Contracts\Parser\Reflection\ConstantReflectionInterface
Результат string
    public function createForConstant(ConstantReflectionInterface $constant)
    {
        // Class constant
        if ($className = $constant->getDeclaringClassName()) {
            return $this->createForClass($className) . '#' . $constant->getName();
        }
        // Constant in namespace or global space
        return sprintf($this->configuration->getOption(CO::TEMPLATE)['templates']['constant']['filename'], Filters::urlize($constant->getName()));
    }

Usage Example

Пример #1
0
 /**
  * @return string
  */
 private function createForConstant(ConstantReflectionInterface $reflectionConstant, array $classes)
 {
     $url = $this->elementUrlFactory->createForConstant($reflectionConstant);
     if ($reflectionConstant->getDeclaringClassName()) {
         $text = $reflectionConstant->getDeclaringClassName() . '::' . Html::el('b')->setText($reflectionConstant->getName());
     } else {
         $text = $this->getGlobalConstantName($reflectionConstant);
     }
     return $this->linkBuilder->build($url, $text, FALSE, $classes);
 }
All Usage Examples Of ApiGen\Templating\Filters\Helpers\ElementUrlFactory::createForConstant