diff --git a/api/config/bundles.php b/api/config/bundles.php index 0b350522..4f75440e 100644 --- a/api/config/bundles.php +++ b/api/config/bundles.php @@ -1,20 +1,20 @@ ['all' => true], - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], - Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], - Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], - Conduction\CommonGroundBundle\CommonGroundBundle::class => ['all' => true], - Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], + Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], + ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], + Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Conduction\CommonGroundBundle\CommonGroundBundle::class => ['all' => true], + Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], - Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true], - Tbbc\MoneyBundle\TbbcMoneyBundle::class => ['all' => true], - Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true], + Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true], + Tbbc\MoneyBundle\TbbcMoneyBundle::class => ['all' => true], + Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true], ]; diff --git a/api/src/Command/ApiHelmCommand.php b/api/src/Command/ApiHelmCommand.php index 0caa16f6..72c6793c 100644 --- a/api/src/Command/ApiHelmCommand.php +++ b/api/src/Command/ApiHelmCommand.php @@ -65,9 +65,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } else { // outputs multiple lines to the console (adding "\n" at the end of each line) $output->writeln([ - 'Helm Chart Creator', - '============', - $chart, + 'Helm Chart Creator', + '============', + $chart, ]); } } diff --git a/api/src/Command/PubliccodeCommand.php b/api/src/Command/PubliccodeCommand.php index 75c24371..1ff5e1fe 100644 --- a/api/src/Command/PubliccodeCommand.php +++ b/api/src/Command/PubliccodeCommand.php @@ -57,14 +57,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $publiccode = $this->twig->render('publiccode/publiccode.yaml.twig'); if (!empty($location = $input->getOption('location')) && \is_string($location)) { - file_put_contents($location.'/publiccode.yaml', $publiccode); + file_put_contents($location.'/publiccode.yaml', $publiccode); $io->success(sprintf('Data written to %s/publiccode.yaml (specification version %s).', $location, $version)); } else { // outputs multiple lines to the console (adding "\n" at the end of each line) $output->writeln([ - 'Publiccode Chart', - '============', - $chart, + 'Publiccode Chart', + '============', + $chart, ]); } } diff --git a/api/src/Entity/Invoice.php b/api/src/Entity/Invoice.php index a988f4fa..cbf463d4 100644 --- a/api/src/Entity/Invoice.php +++ b/api/src/Entity/Invoice.php @@ -3,7 +3,6 @@ namespace App\Entity; use ApiPlatform\Core\Annotation\ApiFilter; -use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use DateTime; @@ -14,8 +13,8 @@ use Gedmo\Mapping\Annotation as Gedmo; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Validator\Constraints as Assert; /** * An entity representing an invoice. @@ -39,6 +38,7 @@ class Invoice { /** * @var UuidInterface The UUID identifier of this object + * * @example e2984465-190a-4562-829e-a8cca81aa35d * * @@ -78,6 +78,7 @@ class Invoice /** * @var string The human readable reference for this request, build as {gemeentecode}-{year}-{referenceId}. Where gemeentecode is a four digit number for gemeenten and a four letter abriviation for other organizations + * * @example 6666-2019-0000000012 * * @Groups({"read"}) @@ -101,6 +102,7 @@ class Invoice /** * @var string The RSIN of the organization that ownes this proces + * * @example 002851234 * * @Assert\NotNull @@ -124,6 +126,7 @@ class Invoice /** * @var string The price of this product + * * @example 50.00 * * @Groups({"read","write"}) @@ -134,6 +137,7 @@ class Invoice /** * @var string The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + * * @example EUR * * @Assert\Currency @@ -143,6 +147,7 @@ class Invoice private $priceCurrency; /** * @var string The total tax over the invoice + * * @example 21.00 * * @Groups({"read","write"}) @@ -152,6 +157,7 @@ class Invoice /** * @var DateTime The moment this request was created by the submitter + * * @example 20190101 * * @Groups({"read"}) @@ -162,6 +168,7 @@ class Invoice /** * @var string The order of this invoice + * * @example https://www.example.org/order/1 * * @Assert\Length( @@ -345,7 +352,7 @@ public function getOrder(): ?string public function setOrder(?string $order): self { - $this->order = $order ; + $this->order = $order; return $this; } @@ -380,6 +387,4 @@ public function removePayment(Payment $payment): self return $this; } - - } diff --git a/api/src/Entity/InvoiceItem.php b/api/src/Entity/InvoiceItem.php index f94fdf17..8b780ef0 100644 --- a/api/src/Entity/InvoiceItem.php +++ b/api/src/Entity/InvoiceItem.php @@ -2,15 +2,14 @@ namespace App\Entity; -use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; use DateTime; -use Ramsey\Uuid\UuidInterface; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; +use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Validator\Constraints as Assert; /** * An entity representing an item of an invoice. @@ -33,6 +32,7 @@ class InvoiceItem { /** * @var UuidInterface + * * @example e2984465-190a-4562-829e-a8cca81aa35d * * @Assert\Uuid @@ -79,6 +79,7 @@ class InvoiceItem /** * @var string The offer this item represents + * * @example http://example.org/offers/1 * * @ORM\Column(type="string", length=255) @@ -105,6 +106,7 @@ class InvoiceItem /** * @var int The quantity of the items that are ordered + * * @example 1 * * @Groups({"read","write"}) @@ -116,6 +118,7 @@ class InvoiceItem /** * @var string The price of this product + * * @example 50.00 * * @Groups({"read","write"}) @@ -126,6 +129,7 @@ class InvoiceItem /** * @var string The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + * * @example EUR * * @Assert\Currency @@ -136,6 +140,7 @@ class InvoiceItem /** * @var int The tax percentage for this offer as an integer e.g. 9% makes 9 + * * @example 9 * * @Assert\NotBlank diff --git a/api/src/Entity/Payment.php b/api/src/Entity/Payment.php index c32ad1dc..c5bf00f8 100644 --- a/api/src/Entity/Payment.php +++ b/api/src/Entity/Payment.php @@ -2,13 +2,11 @@ namespace App\Entity; -use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\UuidInterface; -use Gedmo\Mapping\Annotation as Gedmo; -use Symfony\Component\Serializer\Annotation\MaxDepth; use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Annotation\MaxDepth; use Symfony\Component\Validator\Constraints as Assert; /** @@ -17,7 +15,6 @@ * This entity represents a payment of an invoice. * * @author Barry Brands - * * @license EUPL * * @category entity @@ -32,6 +29,7 @@ class Payment { /** * @var UuidInterface + * * @example e2984465-190a-4562-829e-a8cca81aa35d * * @Assert\Uuid @@ -45,6 +43,7 @@ class Payment /** * @var string The provider that handles the payment + * * @example iDeal * * @Assert\NotNull @@ -58,6 +57,7 @@ class Payment /** * @var string The payment id of this payment + * * @example 87782426a21cbd70fc9823cbe1e024fb25804c833743b41529a23ae94b3b1cc2 * * @Assert\NotNull @@ -71,6 +71,7 @@ class Payment /** * @var string The status of this payment + * * @example open * * @Assert\NotNull diff --git a/api/src/Filter/LikeFilter.php b/api/src/Filter/LikeFilter.php index 029c73e9..0bff7b42 100644 --- a/api/src/Filter/LikeFilter.php +++ b/api/src/Filter/LikeFilter.php @@ -36,14 +36,14 @@ public function getDescription(string $resourceClass): array $description = []; foreach ($this->properties as $property => $strategy) { $description["like_$property"] = [ - 'property' => $property, - 'type' => 'string', - 'required' => false, - 'swagger' => [ - 'description' => 'This filter narows your result using the * and _ wildcards, where * is assumed to be one or more characters and _ is assumed to be a single character', - 'name' => $property, - 'type' => 'string', - ], + 'property' => $property, + 'type' => 'string', + 'required' => false, + 'swagger' => [ + 'description' => 'This filter narows your result using the * and _ wildcards, where * is assumed to be one or more characters and _ is assumed to be a single character', + 'name' => $property, + 'type' => 'string', + ], ]; } diff --git a/api/src/Filter/RegexpFilter.php b/api/src/Filter/RegexpFilter.php index da1f747e..257b8f7b 100644 --- a/api/src/Filter/RegexpFilter.php +++ b/api/src/Filter/RegexpFilter.php @@ -36,14 +36,14 @@ public function getDescription(string $resourceClass): array $description = []; foreach ($this->properties as $property => $strategy) { $description["regexp_$property"] = [ - 'property' => $property, - 'type' => 'string', - 'required' => false, - 'swagger' => [ - 'description' => 'Filter for an exact match using a [Regular expression](https://en.wikipedia.org/wiki/Regular_expression).', - 'name' => $property, - 'type' => 'string', - ], + 'property' => $property, + 'type' => 'string', + 'required' => false, + 'swagger' => [ + 'description' => 'Filter for an exact match using a [Regular expression](https://en.wikipedia.org/wiki/Regular_expression).', + 'name' => $property, + 'type' => 'string', + ], ]; } diff --git a/api/src/Repository/NLXRequestLogRepository.php b/api/src/Repository/NLXRequestLogRepository.php index 69add53c..33986f87 100644 --- a/api/src/Repository/NLXRequestLogRepository.php +++ b/api/src/Repository/NLXRequestLogRepository.php @@ -6,7 +6,6 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Common\Persistence\ManagerRegistry; - /** * @method NLXRequestLog|null find($id, $lockMode = null, $lockVersion = null) * @method NLXRequestLog|null findOneBy(array $criteria, array $orderBy = null) @@ -15,10 +14,10 @@ */ class NLXRequestLogRepository extends ServiceEntityRepository { - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, ExampleEntity::class); - } + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ExampleEntity::class); + } /** * @return NLXRequestLog[] Returns an array of NLXRequestLog objects diff --git a/api/src/Subscriber/FieldsAndExtendSubscriber.php b/api/src/Subscriber/FieldsAndExtendSubscriber.php index d50440c7..e4e45b7a 100644 --- a/api/src/Subscriber/FieldsAndExtendSubscriber.php +++ b/api/src/Subscriber/FieldsAndExtendSubscriber.php @@ -8,8 +8,8 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\Serializer\SerializerInterface; class FieldsAndExtendSubscriber implements EventSubscriberInterface { @@ -27,13 +27,13 @@ public function __construct(ParameterBagInterface $params, SerializerInterface $ public static function getSubscribedEvents() { return [ - KernelEvents::VIEW => ['FilterFields', EventPriorities::PRE_SERIALIZE], + KernelEvents::VIEW => ['FilterFields', EventPriorities::PRE_SERIALIZE], ]; } public function FilterFields(GetResponseForControllerResultEvent $event) { - /* @todo Contains a bug + /* @todo Contains a bug $result = $event->getControllerResult(); $fields = $event->getRequest()->query->get('fields'); $extends = $event->getRequest()->query->get('extend'); @@ -42,14 +42,14 @@ public function FilterFields(GetResponseForControllerResultEvent $event) $contentType= $event->getRequest()->headers->get('Accept'); } - + // Only do somthing if fields is query supplied if (!$fields && !$extends) { return $result; } - + // This needs to be bassed on the content-type - + // Lets set a return content type switch ($contentType) { case 'application/json': @@ -73,15 +73,15 @@ public function FilterFields(GetResponseForControllerResultEvent $event) if (!is_array($extends)) { $extends= explode(',', $extends); } - + // Its possible to nest fields for filterins foreach($fields as $key=>$value){ // Lets check if the fields contain one or more .'s if (strpos($value, '.') !== false) { - // This is where it gets complicated couse it could go on indevinitly + // This is where it gets complicated couse it could go on indevinitly } } - + // Overwrite maxdepth for extended properties // we always need to return an id and links (in order not to break stuff) @@ -95,18 +95,18 @@ public function FilterFields(GetResponseForControllerResultEvent $event) // now we need to overide the normal subscriber $json = $this->serializer->serialize( $result, - $renderType, - ['enable_max_depth' => true, + $renderType, + ['enable_max_depth' => true, 'attributes'=> $fields] ); - - + + $jsonArray = json_decode($json, true); - - + + // The we want to extend properties from the extend query foreach($extends as $extend){ - // @todo add security checks + // @todo add security checks // Get new object for the extend $extendObject = $this->propertyAccessor->getValue($result, $extend); // turn to json @@ -115,12 +115,12 @@ public function FilterFields(GetResponseForControllerResultEvent $event) $type, ['enable_max_depth' => true, 'attributes'=> $fields] - ); + ); // add to the array $jsonArray[$extend] = json_decode($extendjson, true); } - - + + $json = json_encode($jsonArray); $response = new Response( diff --git a/api/src/Subscriber/NLXSubscriber.php b/api/src/Subscriber/NLXSubscriber.php index 5411001e..09cd5e55 100644 --- a/api/src/Subscriber/NLXSubscriber.php +++ b/api/src/Subscriber/NLXSubscriber.php @@ -33,8 +33,8 @@ public function __construct(ParameterBagInterface $params, EntityManagerInterfac public static function getSubscribedEvents() { return [ - KernelEvents::VIEW => ['NLXLog', EventPriorities::PRE_VALIDATE], - KernelEvents::VIEW => ['NLXAudit', EventPriorities::PRE_SERIALIZE], + KernelEvents::VIEW => ['NLXLog', EventPriorities::PRE_VALIDATE], + KernelEvents::VIEW => ['NLXAudit', EventPriorities::PRE_SERIALIZE], ]; } diff --git a/api/src/Subscriber/ValidOnSubscriber.php b/api/src/Subscriber/ValidOnSubscriber.php index 4aac9f15..dd237ae9 100644 --- a/api/src/Subscriber/ValidOnSubscriber.php +++ b/api/src/Subscriber/ValidOnSubscriber.php @@ -29,7 +29,7 @@ public function __construct(ParameterBagInterface $params, EntityManagerInterfac public static function getSubscribedEvents() { return [ - KernelEvents::VIEW => ['validOn', EventPriorities::PRE_SERIALIZE], + KernelEvents::VIEW => ['validOn', EventPriorities::PRE_SERIALIZE], ]; } diff --git a/api/src/Swagger/SwaggerDecorator.php b/api/src/Swagger/SwaggerDecorator.php index acb8988e..e0883841 100644 --- a/api/src/Swagger/SwaggerDecorator.php +++ b/api/src/Swagger/SwaggerDecorator.php @@ -114,7 +114,7 @@ public function normalize($object, $format = null, array $context = []) //$additionalEntityDocs = $this->getAdditionalEntityDocs($entity); $entityDocs = $this->getAdditionalEntityDocs($entity); // Only run if we have aditional docs - if(array_key_exists('properties',$entityDocs)){ + if (array_key_exists('properties', $entityDocs)) { $additionalDocs = array_merge($additionalDocs, $entityDocs['properties']); } @@ -418,7 +418,6 @@ private function getAdditionalEntityDocs($entity) $atributes = []; $groups = []; - foreach ($tags as $tag) { $name = $tag->getName(); $description = $tag->getDescription(); @@ -445,47 +444,47 @@ private function getAdditionalEntityDocs($entity) // Constrainds (Validation) case "Assert\Date": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'date'; $atributes['example'] = \date('Y-m-d'); break; case "Assert\DateTime": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'date-time'; $atributes['example'] = \date('Y-m-d H:i:s'); break; case "Assert\Time": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'time'; $atributes['example'] = \date('H:i:s'); break; case "Assert\Timezone": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'timezone'; $atributes['example'] = 'America/New_York'; break; case "Assert\Uuid": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'uuid'; break; case "Assert\Email": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'email'; break; case "Assert\Url": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'url'; break; case "Assert\Regex": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'regex'; break; case "Assert\Ip": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'ip'; break; case "Assert\Json": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'json'; break; case "Assert\Choice":