Browse Source

ensure methods, properties and events to be unique

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
b494493482
  1. 4
      extensions/yii/apidoc/models/ClassDoc.php
  2. 16
      extensions/yii/apidoc/models/Context.php
  3. 8
      extensions/yii/apidoc/models/TypeDoc.php

4
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;
}
}
}

16
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);
}
}

8
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;

Loading…
Cancel
Save