Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored and StyleCIBot committed Jan 23, 2018
1 parent 8f58233 commit f3ce9ae
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 21 deletions.
5 changes: 2 additions & 3 deletions src/Engines/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace Spatie\Ssr\Engines;

use Illuminate\Support\Facades\Storage;
use Spatie\Ssr\Engine;
use Spatie\Ssr\Exceptions\EngineError;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;

class Node implements Engine
{
Expand Down Expand Up @@ -46,6 +45,6 @@ public function getDispatchHandler(): string

protected function createTempFilePath(): string
{
return $this->tempPath . '/' . md5(time()) . '.js';
return $this->tempPath.'/'.md5(time()).'.js';
}
}
10 changes: 4 additions & 6 deletions src/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Spatie\Ssr;

use Exception;
use Illuminate\Contracts\Support\Htmlable;
use Spatie\Ssr\Exceptions\EngineError;

class Renderer
Expand Down Expand Up @@ -91,7 +89,7 @@ public function entry(string $entry)
*/
public function withContext($context, $value = null)
{
if (!is_array($context)) {
if (! is_array($context)) {
$context = [$context => $value];
}

Expand Down Expand Up @@ -239,7 +237,7 @@ protected function environmentScript(): string
$process = empty($this->env) ? '{}' : json_encode($this->env);

$envAssignments = array_map(function ($value, $key) {
return "process.env.{$key} = " . json_encode($value);
return "process.env.{$key} = ".json_encode($value);
}, $this->env, array_keys($this->env));

return implode(';', [
Expand Down Expand Up @@ -272,9 +270,9 @@ protected function renderWithOutput(string $output): string
$scriptTag = "<script{$scriptLoadStrategy} src=\"{$clientScriptUrl}\"></script>";

if ($this->scriptPosition === 'before') {
return $scriptTag . $output;
return $scriptTag.$output;
}

return $output . $scriptTag;
return $output.$scriptTag;
}
}
4 changes: 2 additions & 2 deletions src/Resolvers/PathResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public function __construct(string $rootPath, string $publicPath)

public function getClientScriptUrl(string $identifier): string
{
return $this->publicPath . '/' . trim($identifier, '/') . '-client.js';
return $this->publicPath.'/'.trim($identifier, '/').'-client.js';
}

public function getServerScriptContents(string $identifier): string
{
$path = $this->rootPath . '/' . trim($identifier, '/') . '-server.js';
$path = $this->rootPath.'/'.trim($identifier, '/').'-server.js';

return file_get_contents($path);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Engines/NodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Spatie\Ssr\Tests\Engines;

use PHPUnit\Framework\TestCase;
use Spatie\Ssr\Engines\Node;
use PHPUnit\Framework\TestCase;
use Spatie\Ssr\Exceptions\EngineError;

class NodeTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Engines/V8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Spatie\Ssr\Tests\Engines;

use PHPUnit\Framework\TestCase;
use Spatie\Ssr\Engines\V8;
use PHPUnit\Framework\TestCase;
use Spatie\Ssr\Exceptions\EngineError;

class V8Test extends TestCase
Expand Down
2 changes: 0 additions & 2 deletions tests/Renderer/ClientScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Spatie\Ssr\Tests\Renderer;

use Exception;

class ClientScriptTest extends TestCase
{
/** @test */
Expand Down
10 changes: 5 additions & 5 deletions tests/Renderer/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Spatie\Ssr\Tests\Renderer;

use PHPUnit\Framework\TestCase as BaseTestCase;
use Spatie\Ssr\Engines\Node;
use Spatie\Ssr\Renderer;
use Spatie\Ssr\Engines\Node;
use Spatie\Ssr\Resolvers\PathResolver;
use PHPUnit\Framework\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
Expand All @@ -14,12 +14,12 @@ abstract class TestCase extends BaseTestCase

public function setUp()
{
$nodePath = getenv('NODE_PATH') ? : '/usr/local/bin/node';
$tempPath = __DIR__ . '/../temp';
$nodePath = getenv('NODE_PATH') ?: '/usr/local/bin/node';
$tempPath = __DIR__.'/../temp';

$engine = new Node($nodePath, $tempPath);

$scriptsPath = __DIR__ . '/../scripts';
$scriptsPath = __DIR__.'/../scripts';
$publicPath = '/js';

$resolver = new PathResolver($scriptsPath, $publicPath);
Expand Down
2 changes: 1 addition & 1 deletion tests/Resolvers/PathResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PathResolverTest extends TestCase

public function setUp()
{
$this->scriptsPath = __DIR__ . '/../scripts';
$this->scriptsPath = __DIR__.'/../scripts';
$this->publicPath = '/js';
}

Expand Down

0 comments on commit f3ce9ae

Please sign in to comment.