/**
  * Returns visible properties.
  *
  * @return array
  */
 public function getConstants()
 {
     if (null === $this->constants) {
         $this->constants = array();
         foreach ($this->reflection->getConstantReflections() as $constant) {
             $apiConstant = new ReflectionConstant($constant, self::$generator);
             if (!$this->isDocumented() || $apiConstant->isDocumented()) {
                 $this->constants[$constant->getName()] = $apiConstant;
             }
         }
     }
     return $this->constants;
 }
示例#2
0
 /**
  * Sorts constants by FQN.
  *
  * @param \ApiGen\ReflectionConstant $one
  * @param \ApiGen\ReflectionConstant $two
  *
  * @return integer
  */
 private function sortConstants(ReflectionConstant $one, ReflectionConstant $two)
 {
     return strcasecmp(($one->getDeclaringClassName() ?: $one->getNamespaceName()) . '\\' . $one->getName(), ($two->getDeclaringClassName() ?: $two->getNamespaceName()) . '\\' . $two->getName());
 }
 /**
  * Returns a link to constant in class summary file or to constant summary file.
  *
  * @param \ApiGen\ReflectionConstant $constant Constant reflection
  *
  * @return string
  */
 public function getConstantUrl(ReflectionConstant $constant)
 {
     // Class constant
     if ($className = $constant->getDeclaringClassName()) {
         return $this->getClassUrl($className) . '#' . $constant->getName();
     }
     // Constant in namespace or global space
     return sprintf($this->config->template['templates']['main']['constant']['filename'], $this->urlize($constant->getName()));
 }