diff --git a/extensions/yii/apidoc/models/ClassDoc.php b/extensions/yii/apidoc/models/ClassDoc.php index 7e7e24b..c0d27b5 100644 --- a/extensions/yii/apidoc/models/ClassDoc.php +++ b/extensions/yii/apidoc/models/ClassDoc.php @@ -57,11 +57,11 @@ class ClassDoc extends TypeDoc if (strncmp($constantReflector->getShortName(), 'EVENT_', 6) == 0) { $event = new EventDoc($constantReflector); $event->definedBy = $this->name; - $this->events[] = $event; + $this->events[$event->name] = $event; } else { $constant = new ConstDoc($constantReflector); $constant->definedBy = $this->name; - $this->constants[] = $constant; + $this->constants[$constant->name] = $constant; } } } diff --git a/extensions/yii/apidoc/models/Context.php b/extensions/yii/apidoc/models/Context.php index 0670140..d16c41f 100644 --- a/extensions/yii/apidoc/models/Context.php +++ b/extensions/yii/apidoc/models/Context.php @@ -132,8 +132,8 @@ class Context extends Component if (isset($this->traits[$trait])) { $trait = $this->traits[$trait]; $trait->usedBy[] = $class->name; - $class->properties = array_merge($trait->properties, $class->properties); // TODO make unique - $class->methods = array_merge($trait->methods, $class->methods); // TODO make unique + $class->properties = array_merge($trait->properties, $class->properties); + $class->methods = array_merge($trait->methods, $class->methods); } } } @@ -153,10 +153,6 @@ class Context extends Component $subclass = $this->classes[$subclass]; $subclass->interfaces = array_unique(array_merge($subclass->interfaces, $class->interfaces)); $subclass->traits = array_unique(array_merge($subclass->traits, $class->traits)); - $subclass->events = array_merge($class->events, $subclass->events); // TODO make unique - $subclass->constants = array_merge($class->constants, $subclass->constants); // TODO make unique - $subclass->properties = array_merge($class->properties, $subclass->properties); // TODO make unique - $subclass->methods = array_merge($class->methods, $subclass->methods); // TODO make unique $this->updateSubclassInferfacesTraits($subclass); } } @@ -169,10 +165,10 @@ class Context extends Component { foreach($class->subclasses as $subclass) { $subclass = $this->classes[$subclass]; - $subclass->events = array_merge($class->events, $subclass->events); // TODO make unique - $subclass->constants = array_merge($class->constants, $subclass->constants); // TODO make unique - $subclass->properties = array_merge($class->properties, $subclass->properties); // TODO make unique - $subclass->methods = array_merge($class->methods, $subclass->methods); // TODO make unique + $subclass->events = array_merge($class->events, $subclass->events); + $subclass->constants = array_merge($class->constants, $subclass->constants); + $subclass->properties = array_merge($class->properties, $subclass->properties); + $subclass->methods = array_merge($class->methods, $subclass->methods); $this->updateSubclassInheritance($subclass); } } diff --git a/extensions/yii/apidoc/models/TypeDoc.php b/extensions/yii/apidoc/models/TypeDoc.php index 7ba1027..c2ccd33 100644 --- a/extensions/yii/apidoc/models/TypeDoc.php +++ b/extensions/yii/apidoc/models/TypeDoc.php @@ -36,9 +36,9 @@ class TypeDoc extends BaseDoc private function getFilteredMethods($visibility) { $methods = []; - foreach($this->methods as $method) { + foreach($this->methods as $name => $method) { if ($method->visibility == $visibility) { - $methods[] = $method; + $methods[$name] = $method; } } return $methods; @@ -60,9 +60,9 @@ class TypeDoc extends BaseDoc return []; } $properties = []; - foreach($this->properties as $property) { + foreach($this->properties as $name => $property) { if ($property->visibility == $visibility) { - $properties[] = $property; + $properties[$name] = $property; } } return $properties;