Skip to content

Commit

Permalink
Fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstauffer authored and github-actions[bot] committed Aug 25, 2024
1 parent 3f30051 commit 13da2f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions cli/Valet/Cloudflared.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

class Cloudflared
{
public function __construct(public CommandLine $cli, public Brew $brew)
{
}
public function __construct(public CommandLine $cli, public Brew $brew) {}

public function currentTunnelUrl(string $domain): ?string
{
Expand Down Expand Up @@ -38,7 +36,7 @@ public function currentTunnelUrl(string $domain): ?string

try {
// Get the cloudflared share URL from the metrics server output
$body = (new Client())->get("http://{$lsofMatches['server']}/metrics")->getBody();
$body = (new Client)->get("http://{$lsofMatches['server']}/metrics")->getBody();
preg_match('/userHostname="(?<url>.+)"/', $body->getContents(), $userHostnameMatches);
} catch (\Exception $e) {
return false;
Expand Down
7 changes: 3 additions & 4 deletions cli/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function (ConsoleCommandEvent $event) {
$share_tools = [
'cloudflared',
'expose',
'ngrok'
'ngrok',
];

/**
Expand Down Expand Up @@ -403,14 +403,13 @@ function (ConsoleCommandEvent $event) {
/**
* Echo or set the name of the currently-selected share tool (either "ngrok" or "expose").
*/
$app->command('share-tool [tool]', function (InputInterface $input, OutputInterface $output, $tool = null)
use ($share_tools) {
$app->command('share-tool [tool]', function (InputInterface $input, OutputInterface $output, $tool = null) use ($share_tools) {
if ($tool === null) {
return output(Configuration::read()['share-tool'] ?? '(not set)');
}

$share_tools_list = preg_replace('/,\s([^,]+)$/', ' or $1',
join(', ', array_map(fn($t) => "`$t`", $share_tools)));
implode(', ', array_map(fn ($t) => "`$t`", $share_tools)));

if (! in_array($tool, $share_tools) || ! class_exists($tool)) {
warning("$tool is not a valid share tool. Please use $share_tools_list.");
Expand Down

0 comments on commit 13da2f7

Please sign in to comment.