/**
  * @param ClassManager $class
  * @return string
  * @throws RendererException
  */
 protected function renderClass(ClassManager $class)
 {
     $template = $class->getTemplate();
     $tags = $class->getTemplateTags();
     $properties = [];
     $methods = [];
     $interfacePart = '';
     $extendsPart = '';
     foreach ($class->getProperties() as $property) {
         $properties[] = $this->render($property);
     }
     foreach ($class->getMethods() as $method) {
         $methods[] = $this->render($method);
     }
     if ($class->hasExtends()) {
         $extendsPart = sprintf(" extends %s", $class->getExtends());
     }
     if ($class->hasInterface()) {
         $interfacePart = sprintf(" implements %s", $class->getInterface()->getNamespace());
     }
     $args[RenderableInterface::TAG_NAMESPACE] = $class->getNamespaceWithoutNameAndBackslashPrefix();
     $args[RenderableInterface::TAG_COMMENT] = empty($class->getComment()) ? "" : sprintf(" %s", $class->getComment());
     $args[RenderableInterface::TAG_NAME] = $class->getName();
     $args[RenderableInterface::TAG_EXTENDS] = $extendsPart;
     $args[RenderableInterface::TAG_INTERFACE] = $interfacePart;
     $args[RenderableInterface::TAG_CONSTRUCTOR] = $this->render($class->getConstructor());
     $args[RenderableInterface::TAG_PROPERTIES] = Tools::implodeArrayToTemplate($properties);
     $args[RenderableInterface::TAG_METHODS] = Tools::implodeArrayToTemplate($methods);
     $args[RenderableInterface::TAG_MULTILINE_COMMENT] = $this->prepareMultilineCommentForElement($class);
     return $this->addNewLineAfter($this->replace($tags, $args, $template));
 }