Commit b4944934 by Carsten Brandt

ensure methods, properties and events to be unique

parent da161734
...@@ -57,11 +57,11 @@ class ClassDoc extends TypeDoc ...@@ -57,11 +57,11 @@ class ClassDoc extends TypeDoc
if (strncmp($constantReflector->getShortName(), 'EVENT_', 6) == 0) { if (strncmp($constantReflector->getShortName(), 'EVENT_', 6) == 0) {
$event = new EventDoc($constantReflector); $event = new EventDoc($constantReflector);
$event->definedBy = $this->name; $event->definedBy = $this->name;
$this->events[] = $event; $this->events[$event->name] = $event;
} else { } else {
$constant = new ConstDoc($constantReflector); $constant = new ConstDoc($constantReflector);
$constant->definedBy = $this->name; $constant->definedBy = $this->name;
$this->constants[] = $constant; $this->constants[$constant->name] = $constant;
} }
} }
} }
......
...@@ -132,8 +132,8 @@ class Context extends Component ...@@ -132,8 +132,8 @@ class Context extends Component
if (isset($this->traits[$trait])) { if (isset($this->traits[$trait])) {
$trait = $this->traits[$trait]; $trait = $this->traits[$trait];
$trait->usedBy[] = $class->name; $trait->usedBy[] = $class->name;
$class->properties = array_merge($trait->properties, $class->properties); // TODO make unique $class->properties = array_merge($trait->properties, $class->properties);
$class->methods = array_merge($trait->methods, $class->methods); // TODO make unique $class->methods = array_merge($trait->methods, $class->methods);
} }
} }
} }
...@@ -153,10 +153,6 @@ class Context extends Component ...@@ -153,10 +153,6 @@ class Context extends Component
$subclass = $this->classes[$subclass]; $subclass = $this->classes[$subclass];
$subclass->interfaces = array_unique(array_merge($subclass->interfaces, $class->interfaces)); $subclass->interfaces = array_unique(array_merge($subclass->interfaces, $class->interfaces));
$subclass->traits = array_unique(array_merge($subclass->traits, $class->traits)); $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); $this->updateSubclassInferfacesTraits($subclass);
} }
} }
...@@ -169,10 +165,10 @@ class Context extends Component ...@@ -169,10 +165,10 @@ class Context extends Component
{ {
foreach($class->subclasses as $subclass) { foreach($class->subclasses as $subclass) {
$subclass = $this->classes[$subclass]; $subclass = $this->classes[$subclass];
$subclass->events = array_merge($class->events, $subclass->events); // TODO make unique $subclass->events = array_merge($class->events, $subclass->events);
$subclass->constants = array_merge($class->constants, $subclass->constants); // TODO make unique $subclass->constants = array_merge($class->constants, $subclass->constants);
$subclass->properties = array_merge($class->properties, $subclass->properties); // TODO make unique $subclass->properties = array_merge($class->properties, $subclass->properties);
$subclass->methods = array_merge($class->methods, $subclass->methods); // TODO make unique $subclass->methods = array_merge($class->methods, $subclass->methods);
$this->updateSubclassInheritance($subclass); $this->updateSubclassInheritance($subclass);
} }
} }
......
...@@ -36,9 +36,9 @@ class TypeDoc extends BaseDoc ...@@ -36,9 +36,9 @@ class TypeDoc extends BaseDoc
private function getFilteredMethods($visibility) private function getFilteredMethods($visibility)
{ {
$methods = []; $methods = [];
foreach($this->methods as $method) { foreach($this->methods as $name => $method) {
if ($method->visibility == $visibility) { if ($method->visibility == $visibility) {
$methods[] = $method; $methods[$name] = $method;
} }
} }
return $methods; return $methods;
...@@ -60,9 +60,9 @@ class TypeDoc extends BaseDoc ...@@ -60,9 +60,9 @@ class TypeDoc extends BaseDoc
return []; return [];
} }
$properties = []; $properties = [];
foreach($this->properties as $property) { foreach($this->properties as $name => $property) {
if ($property->visibility == $visibility) { if ($property->visibility == $visibility) {
$properties[] = $property; $properties[$name] = $property;
} }
} }
return $properties; return $properties;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment