Skip to content

Commit

Permalink
Merge pull request #1 from AlvaroRosado/master
Browse files Browse the repository at this point in the history
Changes for adapt the ui package to the new team-share-documentation classes structure
  • Loading branch information
cluster28 authored Mar 11, 2022
2 parents 825a8b5 + bebe231 commit a39d0b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions src/Twig/Extension/DatatablesExtension.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Cluster28\TeamShareDocumentationUi\Twig\Extension;

use Cluster28\TeamShareDocumentation\Model\Collection\Annotations;
use Cluster28\TeamShareDocumentation\Annotation\ShareAnnotation;
use Cluster28\TeamShareDocumentation\Model\Annotation;
use Cluster28\TeamShareDocumentation\Model\AnnotationData;
use Cluster28\TeamShareDocumentation\Model\ExtractionResult;
use Cluster28\TeamShareDocumentation\Model\ClassInfo;
use Cluster28\TeamShareDocumentationUi\Configuration\Templates\DatatablejsBs5Configuration;
use ReflectionClass;
use ReflectionMethod;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

Expand All @@ -31,31 +33,25 @@ public function getTableConfig(): string
return json_encode($this->datatablejsBs5Configuration->getConfig());
}

public function getTableRows(Annotations $annotations): string
public function getTableRows(ExtractionResult $extractionResult): string
{
$rows = [];
foreach ($annotations as $arrayAnnotation) {
$rows[] = $this->getTableRow($arrayAnnotation);
foreach ($extractionResult->getAllAnnotations() as $annotation) {
$rows[] = $this->getTableRow($annotation);
}
return json_encode($rows);
}

private function getTableRow($arrayAnnotation): array
private function getTableRow(AnnotationData $annotationData): array
{
$class = $method = '';
if ($arrayAnnotation[0] instanceof ReflectionClass) {
$class = $arrayAnnotation[0]->getName();
} elseif ($arrayAnnotation[0] instanceof ReflectionMethod) {
$class = $arrayAnnotation[0]->class;
$method = $arrayAnnotation[0]->getName();
}

/** @var ShareAnnotation $annotation */
$annotation = $annotationData->getAnnotation();
return [
$arrayAnnotation[1]->date,
$class,
$method,
$arrayAnnotation[1]->description,
$arrayAnnotation[1]->tags
$annotation->getDate(),
$annotationData->getClassName(),
$annotationData->isInMethod() ? $annotationData->getMethodName() : "",
$annotation->getDescription(),
$annotation->getTags()
];
}
}
Empty file modified src/Twig/TwigFactory.php
100644 → 100755
Empty file.

0 comments on commit a39d0b0

Please sign in to comment.