Skip to content

Commit

Permalink
Reformat: variable-class names case
Browse files Browse the repository at this point in the history
  • Loading branch information
Fahri Meral committed Oct 1, 2023
1 parent eed7b75 commit 5d76a1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/Controllers/RequirementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function __construct(RequirementsChecker $checker)
*/
public function requirements(): View
{
$dbSupportInfo = $this->requirements->checkDBversion(
$dbSupportInfo = $this->requirements->checkDbVersion(
config('installer.core.minDbVersion')
);

$phpSupportInfo = $this->requirements->checkPHPversion(
$phpSupportInfo = $this->requirements->checkPhpVersion(
config('installer.core.minPhpVersion')
);

Expand Down
26 changes: 12 additions & 14 deletions src/Helpers/RequirementsChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RequirementsChecker
* @param array $requirements
* @return array
*/
public function check(array $requirements)
public function check(array $requirements): array
{
$results = [];

Expand Down Expand Up @@ -75,9 +75,10 @@ public function check(array $requirements)
/**
* Check PHP version requirement.
*
* @param string|null $minPhpVersion
* @return array
*/
public function checkPHPversion(string $minPhpVersion = null)
public function checkPhpVersion(string $minPhpVersion = null): array
{
$minVersionPhp = $minPhpVersion;
$currentPhpVersion = $this->getPhpVersionInfo();
Expand All @@ -91,22 +92,20 @@ public function checkPHPversion(string $minPhpVersion = null)
$supported = true;
}

$phpStatus = [
return [
'full' => $currentPhpVersion['full'],
'current' => $currentPhpVersion['version'],
'minimum' => $minVersionPhp,
'supported' => $supported,
];

return $phpStatus;
}

/**
* Get current Php version information.
*
* @return array
*/
private static function getPhpVersionInfo()
private static function getPhpVersionInfo(): array
{
$currentVersionFull = PHP_VERSION;
preg_match("#^\d+(\.\d+)*#", $currentVersionFull, $filtered);
Expand All @@ -123,7 +122,7 @@ private static function getPhpVersionInfo()
*
* @return string _minPhpVersion
*/
protected function getMinPhpVersion()
protected function getMinPhpVersion(): string
{
return $this->_minPhpVersion;
}
Expand All @@ -132,9 +131,10 @@ protected function getMinPhpVersion()
/**
* Check DB version requirement.
*
* @param array|null $currentDBVersion
* @return array
*/
public function checkDBversion(array $currentDBVersion = null)
public function checkDbVersion(array $currentDBVersion = null): array
{
// Step 1:: separate version for driver type
$current = $this->getDBVersionInfo()['version'];
Expand All @@ -157,22 +157,20 @@ public function checkDBversion(array $currentDBVersion = null)
$supported = true;
}

$dbStatus = [
return [
'driver' => $currentDBVersion['driver'],
'current' => $currentDBVersion['version'],
'minimum' => $minVersionDB,
'supported' => $supported,
];

return $dbStatus;
}

/**
* Get current DB version information.
*
* @return array
*/
private static function getDBVersionInfo()
private static function getDBVersionInfo(): array
{
$dbServerVersion = \DB::connection()->getPdo()->getAttribute(\PDO::ATTR_SERVER_VERSION);
$dbDriverName = \DB::connection()->getPdo()->getAttribute(\PDO::ATTR_DRIVER_NAME);
Expand All @@ -188,7 +186,7 @@ private static function getDBVersionInfo()
*
* @return string
*/
protected function getMinDBVersion()
protected function getMinDBVersion(): string
{
$current = $this->getDBVersionInfo()['version'];

Expand All @@ -208,7 +206,7 @@ protected function getMinDBVersion()
* @param $word
* @return bool
*/
function containsWord($str, $word)
function containsWord($str, $word): bool
{
return !!preg_match('#\\b' . preg_quote($word, '#') . '\\b#i', $str);
}
Expand Down

0 comments on commit 5d76a1f

Please sign in to comment.