Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
rompetomp authored and StyleCIBot committed Aug 10, 2019
1 parent ccfd1b9 commit 14f7c9b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
6 changes: 4 additions & 2 deletions DependencyInjection/Configuration.php
@@ -1,14 +1,15 @@
<?php

namespace Rompetomp\InertiaBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* Class Configuration
* Class Configuration.
*
* @package Rompetomp\DependencyInjection
* @author Hannes Vermeire <hannes@codedor.be>
*
* @since 2019-08-02
*/
class Configuration implements ConfigurationInterface
Expand All @@ -25,6 +26,7 @@ public function getConfigTreeBuilder()
->children()
->scalarNode('root_view')->defaultValue('app.html.twig')->end()
->end();

return $treeBuilder;
}
}
7 changes: 4 additions & 3 deletions DependencyInjection/RompetompInertiaExtension.php
@@ -1,4 +1,5 @@
<?php

namespace Rompetomp\InertiaBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
Expand All @@ -7,10 +8,10 @@
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;

/**
* Class RompetompInertiaExtension
* Class RompetompInertiaExtension.
*
* @package Rompetomp\DependencyInjection
* @author Hannes Vermeire <hannes@codedor.be>
*
* @since 2019-08-02
*/
class RompetompInertiaExtension extends ConfigurableExtension
Expand All @@ -25,7 +26,7 @@ class RompetompInertiaExtension extends ConfigurableExtension
*/
protected function loadInternal(array $mergedConfig, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yaml');

$definition = $container->getDefinition('rompetomp_inertia.inertia');
Expand Down
5 changes: 1 addition & 4 deletions EventListener/InertiaListener.php
@@ -1,17 +1,14 @@
<?php


namespace Rompetomp\InertiaBundle\EventListener;


use Rompetomp\InertiaBundle\Service\InertiaInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;

/**
* Class InertiaListener
* @package Rompetomp\InertiaBundle\EventListener
* Class InertiaListener.
*/
class InertiaListener
{
Expand Down
6 changes: 3 additions & 3 deletions RompetompInertiaBundle.php
@@ -1,16 +1,16 @@
<?php

namespace Rompetomp\InertiaBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* Class RompetompInertiaBundle
* Class RompetompInertiaBundle.
*
* @package Rompetomp\InertiaBundle
* @author Hannes Vermeire <hannes@codedor.be>
*
* @since 2019-08-02
*/
class RompetompInertiaBundle extends Bundle
{

}
6 changes: 4 additions & 2 deletions Service/Inertia.php
Expand Up @@ -44,6 +44,7 @@ public function getShared(string $key = null)
if ($key) {
return $this->sharedProps[$key] ?? null;
}

return $this->sharedProps;
}

Expand Down Expand Up @@ -72,13 +73,14 @@ public function render($component, $props = []): Response

if ($request->headers->get('X-Inertia')) {
return new JsonResponse($page, 200, [
'Vary' => 'Accept',
'X-Inertia' => true
'Vary' => 'Accept',
'X-Inertia' => true,
]);
}

$response = new Response();
$response->setContent($this->engine->render($this->rootView, compact('page')));

return $response;
}
}
5 changes: 3 additions & 2 deletions Service/InertiaInterface.php
@@ -1,13 +1,14 @@
<?php

namespace Rompetomp\InertiaBundle\Service;

use Symfony\Component\HttpFoundation\Response;

/**
* Interface InertiaInterface
* Interface InertiaInterface.
*
* @package Rompetomp\InertiaBundle\Service
* @author Hannes Vermeire <hannes@codedor.be>
*
* @since 2019-08-09
*/
interface InertiaInterface
Expand Down
3 changes: 2 additions & 1 deletion Tests/InertiaTest.php
@@ -1,4 +1,5 @@
<?php

namespace Rompetomp\InertiaBundle\Tests;

use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -42,7 +43,7 @@ public function testSharedMultiple()
$this->assertEquals(
[
'app_version' => '2.0.0',
'app_name' => 'Testing App 2'
'app_name' => 'Testing App 2',
],
$this->inertia->getShared()
);
Expand Down
7 changes: 4 additions & 3 deletions Twig/InertiaExtension.php
@@ -1,15 +1,16 @@
<?php

namespace Rompetomp\InertiaBundle\Twig;

use Twig\Extension\AbstractExtension;
use Twig\Markup;
use Twig\TwigFunction;

/**
* Class InertiaExtension
* Class InertiaExtension.
*
* @package Rompetomp\InertiaBundle\Twig
* @author Hannes Vermeire <hannes@codedor.be>
*
* @since 2019-08-09
*/
class InertiaExtension extends AbstractExtension
Expand All @@ -21,6 +22,6 @@ public function getFunctions()

public function inertiaFunction($page)
{
return new Markup('<div id="app" data-page="' . htmlspecialchars(json_encode($page)) . '"></div>', 'UTF-8');
return new Markup('<div id="app" data-page="'.htmlspecialchars(json_encode($page)).'"></div>', 'UTF-8');
}
}

0 comments on commit 14f7c9b

Please sign in to comment.