From 954f8e5fc9717a86c7eee04649dfb1c9843d3571 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 2 Jul 2022 22:37:07 +0000 Subject: [PATCH] Format code with php-cs-fixer This commit fixes the style issues introduced in 1bece90 according to the output from php-cs-fixer. Details: https://deepsource.io/gh/thundersquared/apiscp-webapp-bedrock/transform/f599627c-c087-4877-9756-0e6fe28ceb03/ --- src/lib/module.php | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/src/lib/module.php b/src/lib/module.php index cdea4d4..c25808e 100644 --- a/src/lib/module.php +++ b/src/lib/module.php @@ -19,8 +19,7 @@ class Bedrock_Module extends \Wordpress_Module protected function getAppRoot(string $hostname, string $path = ''): ?string { - if (file_exists($tmp = $this->getDocumentRoot($hostname, $path) . '/wp-config.php')) - { + if (file_exists($tmp = $this->getDocumentRoot($hostname, $path) . '/wp-config.php')) { return $tmp; } @@ -29,19 +28,14 @@ protected function getAppRoot(string $hostname, string $path = ''): ?string protected function getAppRootPath(string $hostname, string $path = ''): ?string { - if ($hostname[0] === '/') - { - if (!($path = realpath($this->domain_fs_path($hostname)))) - { + if ($hostname[0] === '/') { + if (!($path = realpath($this->domain_fs_path($hostname)))) { return null; } $approot = \dirname($path); - } - else - { + } else { $approot = $this->getAppRoot($hostname, $path); - if (!$approot) - { + if (!$approot) { return null; } $approot = $this->domain_fs_path($approot); @@ -76,8 +70,7 @@ public function get_versions(): array // Attempt to retrieve cached versions $cache = \Cache_Super_Global::spawn(); - if (false !== ($ver = $cache->get($key))) - { + if (false !== ($ver = $cache->get($key))) { return $ver; } @@ -85,8 +78,7 @@ public function get_versions(): array $url = self::VERSION_CHECK_URL; $context = stream_context_create(['http' => ['timeout' => 5]]); $contents = file_get_contents($url, false, $context); - if (!$contents) - { + if (!$contents) { return array(); } $versions = json_decode($contents, true); @@ -118,16 +110,14 @@ public function valid(string $hostname, string $path = ''): bool public function get_version(string $hostname, string $path = ''): ?string { - if (!$this->valid($hostname, $path)) - { + if (!$this->valid($hostname, $path)) { return null; } $approot = $this->getAppRootPath($hostname, $path); // is composer.json file missing? - if (!file_exists($approot . '/composer.json')) - { + if (!file_exists($approot . '/composer.json')) { return null; } @@ -139,8 +129,7 @@ public function get_environment(string $hostname, string $path = ''): ?string $approot = $this->getAppRootPath($hostname, $path); // is .env file missing? - if (!file_exists($approot . '/.env')) - { + if (!file_exists($approot . '/.env')) { return null; } @@ -175,8 +164,7 @@ public function get_environments(string $hostname, string $path = ''): ?array $approotpath = $this->getAppRootPath($hostname, $path); // is config/environments/ dir missing? - if (!is_dir($approotpath . '/config/environments/')) - { + if (!is_dir($approotpath . '/config/environments/')) { return null; }