mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
Setup pint & run code style fix
This commit is contained in:
@@ -8,36 +8,36 @@ class DateFormatter
|
||||
{
|
||||
protected static $formats = [
|
||||
[
|
||||
"carbon_format" => "Y M d",
|
||||
"moment_format" => "YYYY MMM DD",
|
||||
'carbon_format' => 'Y M d',
|
||||
'moment_format' => 'YYYY MMM DD',
|
||||
],
|
||||
[
|
||||
"carbon_format" => "d M Y",
|
||||
"moment_format" => "DD MMM YYYY",
|
||||
'carbon_format' => 'd M Y',
|
||||
'moment_format' => 'DD MMM YYYY',
|
||||
],
|
||||
[
|
||||
"carbon_format" => "d/m/Y",
|
||||
"moment_format" => "DD/MM/YYYY",
|
||||
'carbon_format' => 'd/m/Y',
|
||||
'moment_format' => 'DD/MM/YYYY',
|
||||
],
|
||||
[
|
||||
"carbon_format" => "d.m.Y",
|
||||
"moment_format" => "DD.MM.YYYY",
|
||||
'carbon_format' => 'd.m.Y',
|
||||
'moment_format' => 'DD.MM.YYYY',
|
||||
],
|
||||
[
|
||||
"carbon_format" => "d-m-Y",
|
||||
"moment_format" => "DD-MM-YYYY",
|
||||
'carbon_format' => 'd-m-Y',
|
||||
'moment_format' => 'DD-MM-YYYY',
|
||||
],
|
||||
[
|
||||
"carbon_format" => "m/d/Y",
|
||||
"moment_format" => "MM/DD/YYYY",
|
||||
'carbon_format' => 'm/d/Y',
|
||||
'moment_format' => 'MM/DD/YYYY',
|
||||
],
|
||||
[
|
||||
"carbon_format" => "Y/m/d",
|
||||
"moment_format" => " YYYY/MM/DD",
|
||||
'carbon_format' => 'Y/m/d',
|
||||
'moment_format' => ' YYYY/MM/DD',
|
||||
],
|
||||
[
|
||||
"carbon_format" => "Y-m-d",
|
||||
"moment_format" => "YYYY-MM-DD",
|
||||
'carbon_format' => 'Y-m-d',
|
||||
'moment_format' => 'YYYY-MM-DD',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -47,9 +47,9 @@ class DateFormatter
|
||||
|
||||
foreach (static::$formats as $format) {
|
||||
$new[] = [
|
||||
"display_date" => Carbon::now()->format($format['carbon_format']) ,
|
||||
"carbon_format_value" => $format['carbon_format'],
|
||||
"moment_format_value" => $format['moment_format'],
|
||||
'display_date' => Carbon::now()->format($format['carbon_format']),
|
||||
'carbon_format_value' => $format['carbon_format'],
|
||||
'moment_format_value' => $format['moment_format'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
namespace InvoiceShelf\Space;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use InvoiceShelf\Http\Requests\DatabaseEnvironmentRequest;
|
||||
use InvoiceShelf\Http\Requests\DiskEnvironmentRequest;
|
||||
use InvoiceShelf\Http\Requests\DomainEnvironmentRequest;
|
||||
use InvoiceShelf\Http\Requests\MailEnvironmentRequest;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class EnvironmentManager
|
||||
{
|
||||
@@ -28,7 +28,6 @@ class EnvironmentManager
|
||||
/**
|
||||
* Save the database content to the .env file.
|
||||
*
|
||||
* @param DatabaseEnvironmentRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function saveDatabaseVariables(DatabaseEnvironmentRequest $request)
|
||||
@@ -117,7 +116,6 @@ class EnvironmentManager
|
||||
file_get_contents($this->envPath)
|
||||
));
|
||||
|
||||
|
||||
file_put_contents($this->envPath, str_replace(
|
||||
'SESSION_DOMAIN='.config('session.domain'),
|
||||
'SESSION_DOMAIN='.explode(':', $request->app_domain)[0],
|
||||
@@ -135,8 +133,6 @@ class EnvironmentManager
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param DatabaseEnvironmentRequest $request
|
||||
* @return bool
|
||||
*/
|
||||
private function checkDatabaseConnection(DatabaseEnvironmentRequest $request)
|
||||
@@ -172,8 +168,6 @@ class EnvironmentManager
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param DatabaseEnvironmentRequest $request
|
||||
* @return bool
|
||||
*/
|
||||
private function checkVersionRequirements(DatabaseEnvironmentRequest $request, $conn)
|
||||
@@ -224,11 +218,11 @@ class EnvironmentManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the mail content to the .env file.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
* Save the mail content to the .env file.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function saveMailVariables(MailEnvironmentRequest $request)
|
||||
{
|
||||
$mailData = $this->getMailData($request);
|
||||
@@ -266,11 +260,11 @@ class EnvironmentManager
|
||||
|
||||
private function getMailData($request)
|
||||
{
|
||||
$mailFromCredential = "";
|
||||
$extraMailData = "";
|
||||
$extraOldMailData = "";
|
||||
$oldMailData = "";
|
||||
$newMailData = "";
|
||||
$mailFromCredential = '';
|
||||
$extraMailData = '';
|
||||
$extraOldMailData = '';
|
||||
$oldMailData = '';
|
||||
$newMailData = '';
|
||||
|
||||
if (env('MAIL_FROM_ADDRESS') !== null && env('MAIL_FROM_NAME') !== null) {
|
||||
$mailFromCredential =
|
||||
@@ -424,7 +418,7 @@ class EnvironmentManager
|
||||
/**
|
||||
* Save the disk content to the .env file.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function saveDiskVariables(DiskEnvironmentRequest $request)
|
||||
@@ -464,10 +458,10 @@ class EnvironmentManager
|
||||
|
||||
private function getDiskData($request)
|
||||
{
|
||||
$oldDefaultDriver = "";
|
||||
$defaultDriver = "";
|
||||
$oldDiskData = "";
|
||||
$newDiskData = "";
|
||||
$oldDefaultDriver = '';
|
||||
$defaultDriver = '';
|
||||
$oldDiskData = '';
|
||||
$newDiskData = '';
|
||||
|
||||
if ($request->default_driver) {
|
||||
if (env('FILESYSTEM_DRIVER') !== null) {
|
||||
@@ -518,7 +512,7 @@ class EnvironmentManager
|
||||
'DO_SPACES_REGION='.$request->do_spaces_region."\n".
|
||||
'DO_SPACES_BUCKET='.$request->do_spaces_bucket."\n".
|
||||
'DO_SPACES_ENDPOINT='.$request->do_spaces_endpoint."\n";
|
||||
'DO_SPACES_ROOT='.$request->do_spaces_root."\n\n";
|
||||
'DO_SPACES_ROOT='.$request->do_spaces_root."\n\n";
|
||||
|
||||
break;
|
||||
|
||||
@@ -553,7 +547,6 @@ class EnvironmentManager
|
||||
/**
|
||||
* Save sanctum statful domain to the .env file.
|
||||
*
|
||||
* @param DomainEnvironmentRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function saveDomainVariables(DomainEnvironmentRequest $request)
|
||||
@@ -572,12 +565,12 @@ class EnvironmentManager
|
||||
));
|
||||
} catch (Exception $e) {
|
||||
return [
|
||||
'error' => 'domain_verification_failed'
|
||||
'error' => 'domain_verification_failed',
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'success' => 'domain_variable_save_successfully'
|
||||
'success' => 'domain_variable_save_successfully',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ class FilePermissionChecker
|
||||
/**
|
||||
* Check for the folders permissions.
|
||||
*
|
||||
* @param array $folders
|
||||
* @return array
|
||||
*/
|
||||
public function check(array $folders)
|
||||
@@ -43,7 +42,6 @@ class FilePermissionChecker
|
||||
/**
|
||||
* Get a folder permission.
|
||||
*
|
||||
* @param $folder
|
||||
* @return string
|
||||
*/
|
||||
private function getPermission($folder)
|
||||
@@ -53,10 +51,6 @@ class FilePermissionChecker
|
||||
|
||||
/**
|
||||
* Add the file to the list of results.
|
||||
*
|
||||
* @param $folder
|
||||
* @param $permission
|
||||
* @param $isSet
|
||||
*/
|
||||
private function addFile($folder, $permission, $isSet)
|
||||
{
|
||||
@@ -69,10 +63,6 @@ class FilePermissionChecker
|
||||
|
||||
/**
|
||||
* Add the file and set the errors.
|
||||
*
|
||||
* @param $folder
|
||||
* @param $permission
|
||||
* @param $isSet
|
||||
*/
|
||||
private function addFileAndSetErrors($folder, $permission, $isSet)
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
namespace InvoiceShelf\Space;
|
||||
|
||||
use Artisan;
|
||||
use File;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use InvoiceShelf\Events\ModuleEnabledEvent;
|
||||
use InvoiceShelf\Events\ModuleInstalledEvent;
|
||||
use InvoiceShelf\Http\Resources\ModuleResource;
|
||||
use InvoiceShelf\Models\Module as ModelsModule;
|
||||
use InvoiceShelf\Models\Setting;
|
||||
use File;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Nwidart\Modules\Facades\Module;
|
||||
use ZipArchive;
|
||||
|
||||
@@ -56,7 +56,7 @@ class ModuleInstaller
|
||||
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true], $token);
|
||||
|
||||
if ($response && ($response->getStatusCode() == 401)) {
|
||||
return (object)['success' => false, 'error' => 'invalid_token'];
|
||||
return (object) ['success' => false, 'error' => 'invalid_token'];
|
||||
}
|
||||
|
||||
if ($response && ($response->getStatusCode() == 200)) {
|
||||
@@ -137,7 +137,7 @@ class ModuleInstaller
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'path' => $zip_file_path
|
||||
'path' => $zip_file_path,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class ModuleInstaller
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function checkToken(String $token)
|
||||
public static function checkToken(string $token)
|
||||
{
|
||||
$url = 'api/marketplace/ping';
|
||||
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true], $token);
|
||||
|
||||
@@ -18,7 +18,6 @@ class RequirementsChecker
|
||||
/**
|
||||
* Check for the server requirements.
|
||||
*
|
||||
* @param array $requirements
|
||||
* @return array
|
||||
*/
|
||||
public function check(array $requirements)
|
||||
@@ -40,7 +39,7 @@ class RequirementsChecker
|
||||
}
|
||||
|
||||
break;
|
||||
// check apache requirements
|
||||
// check apache requirements
|
||||
case 'apache':
|
||||
foreach ($requirements[$type] as $requirement) {
|
||||
// if function doesn't exist we can't check apache modules
|
||||
@@ -67,7 +66,7 @@ class RequirementsChecker
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function checkPHPVersion(string $minPhpVersion = null)
|
||||
public function checkPHPVersion(?string $minPhpVersion = null)
|
||||
{
|
||||
$minVersionPhp = $minPhpVersion;
|
||||
$currentPhpVersion = $this->getPhpVersionInfo();
|
||||
@@ -167,7 +166,7 @@ class RequirementsChecker
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function checkSqliteVersion(string $minSqliteVersion = null)
|
||||
public function checkSqliteVersion(?string $minSqliteVersion = null)
|
||||
{
|
||||
$minVersionSqlite = $minSqliteVersion;
|
||||
$currentSqliteVersion = $this->getSqliteVersionInfo();
|
||||
@@ -203,7 +202,7 @@ class RequirementsChecker
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function checkPgsqlVersion($conn, string $minPgsqlVersion = null)
|
||||
public function checkPgsqlVersion($conn, ?string $minPgsqlVersion = null)
|
||||
{
|
||||
$minVersionPgsql = $minPgsqlVersion;
|
||||
$currentPgsqlVersion = $this->getPgsqlVersionInfo($conn);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace InvoiceShelf\Space;
|
||||
|
||||
use InvoiceShelf\Models\Setting;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use InvoiceShelf\Models\Setting;
|
||||
|
||||
// Implementation taken from Akaunting - https://github.com/akaunting/akaunting
|
||||
trait SiteApi
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace InvoiceShelf\Space;
|
||||
|
||||
use Artisan;
|
||||
use InvoiceShelf\Events\UpdateFinished;
|
||||
use File;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use InvoiceShelf\Events\UpdateFinished;
|
||||
use ZipArchive;
|
||||
|
||||
// Implementation taken from Akaunting - https://github.com/akaunting/akaunting
|
||||
@@ -36,7 +36,7 @@ class Updater
|
||||
foreach (json_decode($extensions) as $extension) {
|
||||
$extensionData[$extension] = phpversion($extension) ? true : false;
|
||||
}
|
||||
$extensionData['php'.'('.$data->version->minimum_php_version.')'] = version_compare(phpversion(), $data->version->minimum_php_version, ">=");
|
||||
$extensionData['php'.'('.$data->version->minimum_php_version.')'] = version_compare(phpversion(), $data->version->minimum_php_version, '>=');
|
||||
$data->version->extensions = $extensionData;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use InvoiceShelf\Models\CompanySetting;
|
||||
use InvoiceShelf\Models\Currency;
|
||||
use InvoiceShelf\Models\CustomField;
|
||||
use InvoiceShelf\Models\Setting;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Get company setting
|
||||
*
|
||||
* @param $company_id
|
||||
* @return string
|
||||
*/
|
||||
function get_company_setting($key, $company_id)
|
||||
@@ -22,7 +21,7 @@ function get_company_setting($key, $company_id)
|
||||
/**
|
||||
* Get app setting
|
||||
*
|
||||
* @param $company_id
|
||||
* @param $company_id
|
||||
* @return string
|
||||
*/
|
||||
function get_app_setting($key)
|
||||
@@ -35,7 +34,6 @@ function get_app_setting($key)
|
||||
/**
|
||||
* Get page title
|
||||
*
|
||||
* @param $company_id
|
||||
* @return string
|
||||
*/
|
||||
function get_page_title($company_id)
|
||||
@@ -61,26 +59,23 @@ function get_page_title($company_id)
|
||||
/**
|
||||
* Set Active Path
|
||||
*
|
||||
* @param $path
|
||||
* @param string $active
|
||||
* @param string $active
|
||||
* @return string
|
||||
*/
|
||||
function set_active($path, $active = 'active')
|
||||
{
|
||||
return call_user_func_array('Request::is', (array)$path) ? $active : '';
|
||||
return call_user_func_array('Request::is', (array) $path) ? $active : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
* @return mixed
|
||||
*/
|
||||
function is_url($path)
|
||||
{
|
||||
return call_user_func_array('Request::is', (array)$path);
|
||||
return call_user_func_array('Request::is', (array) $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
function getCustomFieldValueKey(string $type)
|
||||
@@ -122,7 +117,6 @@ function getCustomFieldValueKey(string $type)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $money
|
||||
* @return formated_money
|
||||
*/
|
||||
function format_money_pdf($money, $currency = null)
|
||||
@@ -151,7 +145,7 @@ function format_money_pdf($money, $currency = null)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $string
|
||||
* @param $string
|
||||
* @return string
|
||||
*/
|
||||
function clean_slug($model, $title, $id = 0)
|
||||
@@ -191,6 +185,6 @@ function respondJson($error, $message)
|
||||
{
|
||||
return response()->json([
|
||||
'error' => $error,
|
||||
'message' => $message
|
||||
'message' => $message,
|
||||
], 422);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user