Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cursor/rules/04-exceptions.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Traits mixed into Commands ARE Command layer. Display errors directly without re

```php
// ✅ CORRECT - Display exception directly, no prefix
protected function getServerInfo(ServerDTO $server): array|int
protected function serverInfo(ServerDTO $server): array|int
{
try {
$result = $this->executePlaybook($server, 'server-info', 'Gathering...');
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Server/ServerAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Get server info (verifies SSH connection and validates distribution & permissions)
// ----

$info = $this->getServerInfo($server);
$info = $this->serverInfo($server);

if (is_int($info)) {
return $info;
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Server/ServerDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->yay("Server '{$server->name}' deleted from inventory");

if (!$destroyed) {
$this->io->warning('Your server may still be running and incurring costs!');
$this->io->writeln([
'',
'<fg=yellow>Your server may still be running and incurring costs:</>',
' • Double-check with your cloud provider to ensure it is fully terminated.',
'Check with your cloud provider to ensure it is fully terminated.',
'',
]);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Server/ServerInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Get server info (verifies SSH connection and validates distribution & permissions)
// ----

$info = $this->getServerInfo($server);
$info = $this->serverInfo($server);

if (is_int($info)) {
return $info;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Server/ServerInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Get server info (verifies SSH connection and validates distribution & permissions)
// ----

$info = $this->getServerInfo($server);
$info = $this->serverInfo($server);

if (is_int($info)) {
return $info;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Server/ServerInstallPhpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Get server info (verifies SSH connection and validates distribution & permissions)
// ----

$info = $this->getServerInfo($server);
$info = $this->serverInfo($server);

if (is_int($info)) {
return $info;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Server/ServerLogsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Get server info (verifies SSH connection and validates distribution & permissions)
// ----

$info = $this->getServerInfo($server);
$info = $this->serverInfo($server);

if (is_int($info)) {
return $info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->displayServerDeets($server);

// Get server info (verifies SSH connection and validates distribution & permissions)
$info = $this->getServerInfo($server);
$info = $this->serverInfo($server);

if (is_int($info)) {
throw new \RuntimeException('Failed to validate server distribution');
Expand Down
14 changes: 6 additions & 8 deletions app/Traits/ServersTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Reusable server things.
*
* Requires classes using this trait to have IOService, ServerRepository, SSHService, and SiteRepository properties.
* Also requires PlaybooksTrait for getServerInfo() method.
* Also requires PlaybooksTrait for serverInfo() method.
*
* @property IOService $io
* @property ServerRepository $servers
Expand Down Expand Up @@ -44,7 +44,7 @@ trait ServersTrait
* @param ServerDTO $server Server to get information for
* @return array<string, mixed>|int Returns parsed server info or failure code on failure
*/
protected function getServerInfo(ServerDTO $server): array|int
protected function serverInfo(ServerDTO $server): array|int
{
$info = $this->executePlaybook(
$server,
Expand Down Expand Up @@ -264,12 +264,10 @@ protected function displayServerInfo(array $info): void
}
}

if (count($phpItems) === 0) {
$phpItems[] = '<fg=yellow>No PHP installed</>';
if (count($phpItems) > 0) {
$this->io->displayDeets(['PHP' => $phpItems]);
$this->io->writeln('');
}

$this->io->displayDeets(['PHP' => $phpItems]);
$this->io->writeln('');
}

// Display PHP-FPM information if available (multiple versions)
Expand Down Expand Up @@ -392,7 +390,7 @@ private function formatUptime(int $seconds): string
* Automatically sets first PHP install as default, otherwise prompts user.
*
* @param ServerDTO $server Server to install PHP on
* @param array<string, mixed> $info Server information from getServerInfo()
* @param array<string, mixed> $info Server information from serverInfo()
* @return array{status: int, php_version: string, php_default: bool}|int Returns array with status and values, or int on failure
*/
protected function installPhp(ServerDTO $server, array $info): array|int
Expand Down