/**
  * Returns any sub-elements for the given element.
  *
  * This method checks whether the given element is a class, interface or trait and returns
  * their methods, properties and constants accordingly, or an empty array if no sub-elements
  * are applicable.
  *
  * @param DescriptorAbstract $element
  *
  * @return DescriptorAbstract[]
  */
 protected function getSubElements(DescriptorAbstract $element)
 {
     $subElements = array();
     if ($element instanceof ClassInterface) {
         $subElements = array_merge($element->getMethods()->getAll(), $element->getConstants()->getAll(), $element->getProperties()->getAll());
     }
     if ($element instanceof InterfaceInterface) {
         $subElements = array_merge($element->getMethods()->getAll(), $element->getConstants()->getAll());
     }
     if ($element instanceof TraitInterface) {
         $subElements = array_merge($element->getMethods()->getAll(), $element->getProperties()->getAll());
     }
     return $subElements;
 }