Apply Laravel coding style

Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
This commit is contained in:
Shift
2023-01-07 18:47:35 +00:00
parent da241bacb6
commit cade5f0d23
235 changed files with 14452 additions and 14844 deletions

View File

@@ -86,7 +86,7 @@ class Install extends Command
$result = [];
foreach ($extensions as $key => $extension) {
$result[$key]['extension'] = $extension;
if (!extension_loaded($extension)) {
if (! extension_loaded($extension)) {
$result[$key]['status'] = "Not Loading, Please open '".php_ini_loaded_file()."' and add 'extension = ".$extension;
} else {
$result[$key]['status'] = 'Loading';

View File

@@ -46,12 +46,12 @@ class InstallDB extends Command
try {
if ($this->confirm('Do you want to migrate tables now?')) {
$env = base_path().DIRECTORY_SEPARATOR.'.env';
if (!is_file($env)) {
if (! is_file($env)) {
throw new \Exception("Please run 'php artisan install:faveo'");
}
$dummy_confirm = $this->confirm('Would you like to install dummy data in database to test before going live?');
$this->call('key:generate', ['--force' => true]);
if (!$dummy_confirm) {
if (! $dummy_confirm) {
$this->call('install:migrate');
$this->call('install:seed');
} else {
@@ -62,8 +62,8 @@ class InstallDB extends Command
$data = [
[
'user_name' => 'demo_admin',
'email' => '',
'password' => 'demopass',
'email' => '',
'password' => 'demopass',
],
];
$this->table($headers, $data);

View File

@@ -54,10 +54,10 @@ class SecureFaveoAPPKey extends Command
{
$username = $this->ask('Enter admin account username');
$password = $this->secret('Enter admin account password');
if (!$username || !$password) {
if (! $username || ! $password) {
throw new Exception('Username and password are required.', 1);
}
if (!Hash::check($password, User::where('user_name', $username)->value('password'))) {
if (! Hash::check($password, User::where('user_name', $username)->value('password'))) {
throw new Exception('We do not recognize you, make sure the username or password you provided are correct.', 1);
}
@@ -85,15 +85,14 @@ class SecureFaveoAPPKey extends Command
* This method also updates the LDAP passwords after new key generation
* so that the LDAP plugin does not stop working after update
*
* @param string $file
* @param string $datacontent
*
* @param string $file
* @param string $datacontent
* @return voif
*/
private function updateAppKey(string $file, string $datacontent): void
{
$this->fetchAndStoreEmailPassword();
if (!$this->doesEnvVaribaleExists($datacontent, 'APP_KEY')) {
if (! $this->doesEnvVaribaleExists($datacontent, 'APP_KEY')) {
$datacontent = $datacontent."\r\nAPP_KEY=base64:h3KjrHeVxyE+j6c8whTAs2YI+7goylGZ/e2vElgXT6I=";
File::put($file, $datacontent);
}
@@ -112,14 +111,13 @@ class SecureFaveoAPPKey extends Command
/**
* Function checks if given $key exist in $envContent string.
*
* @param string $envContent
* @param string $key
*
* @param string $envContent
* @param string $key
* @return bool true if given key exist otherwise false
*/
private function doesEnvVaribaleExists(string $envContent, string $key): bool
{
return !(strpos($envContent, $key) === false);
return ! (strpos($envContent, $key) === false);
}
/**
@@ -149,11 +147,10 @@ class SecureFaveoAPPKey extends Command
/**
* Extract the encryption key from the given configuration.
*
* @param array $config
* @param array $config
* @return string
*
* @throws \RuntimeException
*
* @return string
*/
private function key()
{

View File

@@ -73,9 +73,8 @@ class SetupTestEnv extends Command
/**
* Sets up DB config for testing.
*
* @param string $dbUsername mysql username
* @param string $dbPassword mysql password
*
* @param string $dbUsername mysql username
* @param string $dbPassword mysql password
* @return null
*/
private function setupConfig($dbUsername, $dbPassword)
@@ -165,9 +164,8 @@ class SetupTestEnv extends Command
/**
* Creates an env file if not exists already.
*
* @param string $dbUsername
* @param string $dbPassword
*
* @param string $dbUsername
* @param string $dbPassword
* @return null
*/
private function createEnv(string $dbUsername, string $dbPassword)