Ejemplo n.º 1
0
 /**
  * Generate UML diagram code.
  *
  * @return bool
  */
 public function generate()
 {
     $this->line('@startuml');
     foreach ($this->builder->getDocuments() as $document) {
         $this->renderDocument($document);
     }
     $this->line('@enduml');
     return join("\n", $this->lines);
 }
Ejemplo n.º 2
0
 /**
  * Export UML classes diagram to specified file, all found Documents with their fields, methods
  * and compositions will be used to generate such UML.
  *
  * @param string $filename
  * @return bool
  */
 public function export($filename)
 {
     $this->line('@startuml');
     foreach ($this->builder->getDocuments() as $document) {
         $this->renderDocument($document);
     }
     $this->line('@enduml');
     return $this->files->write($filename, join("\n", $this->lines));
 }
Ejemplo n.º 3
0
 /**
  * Generates virtual documentation based on provided schema.
  */
 public function document()
 {
     foreach ($this->builder->getDocuments() as $document) {
         if ($document->isAbstract()) {
             continue;
         }
         //Render class and put it under entity name
         $this->addClass($this->renderEntity($document), $document->getNamespaceName());
     }
     //Let's add some uses to virtual namespace
     if (!empty($this->namespaces[$this->documenter->config()['namespace']])) {
         $namespace = $this->namespaces[$this->documenter->config()['namespace']];
         //Required uses
         $namespace->setUses([DocumentCursor::class, CompositorException::class, DefinitionException::class, ODMException::class, ServerRequestInterface::class, PaginationException::class]);
     }
 }
Ejemplo n.º 4
0
 /**
  * Get schema of top parent of current document or document schema itself. This method is
  * reverse implementation of getChildren().
  *
  * @see getChindren()
  * @param bool $sameCollection Only document with same collection.
  * @return DocumentSchema
  */
 public function getParent($sameCollection = false)
 {
     $result = $this;
     foreach ($this->builder->getDocuments() as $document) {
         if (!$result->isSubclassOf($document)) {
             //I'm not your father!
             continue;
         }
         if ($sameCollection && !$result->compareCollection($document)) {
             //Different collection
             continue;
         }
         //Level down
         $result = $document;
     }
     return $result;
 }