Skip to content

Commit

Permalink
Merge pull request #10 from ConductionNL/analysis-EAPVPZ
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
rubenvdlinde authored Jan 13, 2020
2 parents 30a8ee7 + 40b25dc commit 3ecfcc2
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 125 deletions.
30 changes: 15 additions & 15 deletions api/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

return [
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],
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],
];
6 changes: 3 additions & 3 deletions api/src/Command/ApiHelmCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}
}
Expand Down
8 changes: 4 additions & 4 deletions api/src/Command/PubliccodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}
}
Expand Down
16 changes: 8 additions & 8 deletions api/src/Filter/LikeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
];
}

Expand Down
16 changes: 8 additions & 8 deletions api/src/Filter/RegexpFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
];
}

Expand Down
9 changes: 4 additions & 5 deletions api/src/Repository/NLXRequestLogRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
38 changes: 19 additions & 19 deletions api/src/Subscriber/FieldsAndExtendSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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');
Expand All @@ -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':
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions api/src/Subscriber/NLXSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/Subscriber/ValidOnSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
}

Expand Down
Loading

0 comments on commit 3ecfcc2

Please sign in to comment.