Skip to content

Commit 6758daa

Browse files
add ServerProcessInspector interface (#679)
* add ServerProcessInspector interface * Update ServerProcessInspector.php * Update ServerProcessInspector.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 589a212 commit 6758daa

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

src/Commands/Concerns/InteractsWithServers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait InteractsWithServers
1313
* Run the given server process.
1414
*
1515
* @param \Symfony\Component\Process\Process $server
16-
* @param \Laravel\Octane\Swoole\ServerProcessInspector|\Laravel\Octane\RoadRunner\ServerProcessInspector $inspector
16+
* @param \Laravel\Octane\Contracts\ServerProcessInspector $inspector
1717
* @param string $type
1818
* @return int
1919
*/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Laravel\Octane\Contracts;
4+
5+
interface ServerProcessInspector
6+
{
7+
/**
8+
* Determine if the server process is running.
9+
*
10+
* @return bool
11+
*/
12+
public function serverIsRunning(): bool;
13+
14+
/**
15+
* Reload the workers.
16+
*
17+
* @return void
18+
*/
19+
public function reloadServer(): void;
20+
21+
/**
22+
* Stop the server.
23+
*
24+
* @return bool
25+
*/
26+
public function stopServer(): bool;
27+
}

src/RoadRunner/ServerProcessInspector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
namespace Laravel\Octane\RoadRunner;
44

5+
use Laravel\Octane\Contracts\ServerProcessInspector as ServerProcessInspectorContract;
56
use Laravel\Octane\PosixExtension;
67
use Laravel\Octane\RoadRunner\Concerns\FindsRoadRunnerBinary;
78
use Laravel\Octane\SymfonyProcessFactory;
89
use RuntimeException;
910
use Symfony\Component\Process\Process;
1011

11-
class ServerProcessInspector
12+
class ServerProcessInspector implements ServerProcessInspectorContract
1213
{
1314
use FindsRoadRunnerBinary;
1415

src/Swoole/ServerProcessInspector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
namespace Laravel\Octane\Swoole;
44

5+
use Laravel\Octane\Contracts\ServerProcessInspector as ServerProcessInspectorContract;
56
use Laravel\Octane\Exec;
67

7-
class ServerProcessInspector
8+
class ServerProcessInspector implements ServerProcessInspectorContract
89
{
910
public function __construct(
1011
protected SignalDispatcher $dispatcher,

0 commit comments

Comments
 (0)