Skip to content

Commit 6a5ebb1

Browse files
committed
PHP CS fixer execution
1 parent 84ddda0 commit 6a5ebb1

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

bin/reactphp-server

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env php
12
<?php
23

34
/**
@@ -8,6 +9,7 @@
89
* For the full copyright and license information, please view the LICENSE
910
* file that was distributed with this source code.
1011
*/
12+
1113
use Jdomenechb\ReactPhpSymfonyServer\Loop\RequestLoop;
1214
use React\EventLoop\Factory;
1315
use React\Http\Server as HttpServer;

src/Loop/RequestLoop.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public function __construct($kernel, ConsoleOutputInterface $consoleOutput, $pro
4545
*
4646
* @param ServerRequestInterface $request
4747
*
48-
* @return null|Response
4948
* @throws \RuntimeException
49+
*
50+
* @return null|Response
5051
*/
5152
public function request(ServerRequestInterface $request)
5253
{
@@ -121,14 +122,14 @@ public function request(ServerRequestInterface $request)
121122
private function serveAssets(string $method, $path)
122123
{
123124
if ('GET' !== $method) {
124-
return null;
125+
return;
125126
}
126127

127128
$resource = $this->projectRootPath . DIRECTORY_SEPARATOR . 'public'
128129
. \str_replace('/', DIRECTORY_SEPARATOR, $path);
129130

130131
if (!\file_exists($resource) || !\is_file($resource)) {
131-
return null;
132+
return;
132133
}
133134

134135
return new Response(200, [], \file_get_contents($resource));

src/Setup/ServerSetup.php

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Jdomenechb\ReactPhpSymfonyServer\Setup;
1313

14-
1514
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1615

1716
class ServerSetup
@@ -27,8 +26,9 @@ class ServerSetup
2726

2827
/**
2928
* ServerSetup constructor.
30-
* @param string $projectRootPath
31-
* @param string $tmpFile
29+
*
30+
* @param string $projectRootPath
31+
* @param string $tmpFile
3232
* @param ConsoleOutputInterface $consoleOutput
3333
*/
3434
public function __construct(ConsoleOutputInterface $consoleOutput, string $projectRootPath, string $tmpFile)
@@ -38,17 +38,40 @@ public function __construct(ConsoleOutputInterface $consoleOutput, string $proje
3838
$this->consoleOutput = $consoleOutput;
3939
}
4040

41+
/**
42+
* @throws \LogicException
43+
* @throws \RuntimeException
44+
*
45+
* @return string
46+
*/
47+
public function startup(): string
48+
{
49+
$this->checkIndexFileExists();
50+
51+
$this->consoleOutput->writeln('Starting...');
52+
53+
if (\is_file($this->tmpFile)) {
54+
\unlink($this->tmpFile);
55+
}
56+
57+
$this->createTemporalFile();
58+
59+
return $this->tmpFile;
60+
}
61+
4162
/**
4263
* Returns the path to the Symfony index file.
64+
*
4365
* @return string
4466
*/
45-
private function getIndexFilePath() : string
67+
private function getIndexFilePath(): string
4668
{
4769
return $this->projectRootPath . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'index.php';
4870
}
4971

5072
/**
5173
* Checks that the Symfony index file exists.
74+
*
5275
* @throws \RuntimeException
5376
*/
5477
private function checkIndexFileExists()
@@ -91,24 +114,4 @@ private function createTemporalFile()
91114

92115
\file_put_contents($this->tmpFile, $result);
93116
}
94-
95-
/**
96-
* @return string
97-
* @throws \LogicException
98-
* @throws \RuntimeException
99-
*/
100-
public function startup(): string
101-
{
102-
$this->checkIndexFileExists();
103-
104-
$this->consoleOutput->writeln('Starting...');
105-
106-
if (is_file($this->tmpFile)) {
107-
unlink($this->tmpFile);
108-
}
109-
110-
$this->createTemporalFile();
111-
112-
return $this->tmpFile;
113-
}
114-
}
117+
}

0 commit comments

Comments
 (0)