fixed static issues

This commit is contained in:
Peter Papp
2021-05-08 09:41:10 +02:00
parent 8b3c6cfc27
commit 50bdac62dc
20 changed files with 945 additions and 139 deletions

View File

@@ -12,9 +12,10 @@ class UpdateUserPassword implements UpdatesUserPasswords
/**
* Validate and update the user's password.
*
* @param mixed $user
* @param array $input
* @param mixed $user
* @param array $input
* @return void
* @throws \Illuminate\Validation\ValidationException
*/
public function update($user, array $input)
{

View File

@@ -7,6 +7,7 @@ use App\Models\User;
use App\Models\Share;
use App\Models\Folder;
use App\Models\Setting;
use Faker\Generator;
use Illuminate\Support\Str;
use App\Services\SetupService;
use Illuminate\Console\Command;
@@ -31,6 +32,8 @@ class SetupDevEnvironment extends Command
private $setup;
private Generator $faker;
public function __construct()
{
parent::__construct();
@@ -40,6 +43,7 @@ class SetupDevEnvironment extends Command
/**
* Execute the console command.
* return @void
*/
public function handle(): void
{
@@ -606,7 +610,7 @@ class SetupDevEnvironment extends Command
'whaaaaat.jpg',
'You Are My Sunshine.jpg',
])
->each(function ($file) use ($user, $apartments) {
->each(function ($file) use ($user) {
$basename = Str::random(12) . '-' . $file;
// Copy file into app storage

View File

@@ -11,9 +11,8 @@ use App\Http\Resources\UsersCollection;
class DashboardController extends Controller
{
/**
* @param StripeService $stripe
*/
private StripeService $stripe;
public function __construct(StripeService $stripe)
{
$this->stripe = $stripe;
@@ -32,7 +31,7 @@ class DashboardController extends Controller
// Get total storage usage
$storage_usage = Metric::bytes(
DB::table('files')->sum('filesize')
\DB::table('files')->sum('filesize')
)->format();
return [

View File

@@ -9,9 +9,8 @@ use App\Http\Resources\InvoiceAdminCollection;
class InvoiceController extends Controller
{
/**
* @param StripeService $stripe
*/
private StripeService $stripe;
public function __construct(StripeService $stripe)
{
$this->stripe = $stripe;

View File

@@ -12,6 +12,8 @@ use Illuminate\Contracts\Routing\ResponseFactory;
class PagesController extends Controller
{
private $demo;
public function __construct()
{
$this->demo = resolve(DemoService::class);

View File

@@ -18,12 +18,13 @@ use Illuminate\Contracts\Routing\ResponseFactory;
class PlanController extends Controller
{
/**
* @param StripeService $stripe
*/
public function __construct(StripeService $stripe)
private StripeService $stripe;
private DemoService $demo;
public function __construct()
{
$this->stripe = $stripe;
$this->stripe = resolve(StripeService::class);
$this->demo = resolve(DemoService::class);
}

View File

@@ -12,9 +12,8 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class SettingController extends Controller
{
/**
* SettingController constructor.
*/
private $demo;
public function __construct()
{
$this->demo = resolve(DemoService::class);

View File

@@ -23,6 +23,8 @@ use App\Http\Requests\Admin\ChangeStorageCapacityRequest;
class UserController extends Controller
{
private StripeService $stripe;
public function __construct(StripeService $stripe)
{
$this->stripe = $stripe;

View File

@@ -25,11 +25,13 @@ class AppFunctionsController extends Controller
*
* @var array
*/
private $blacklist = [
private array $blacklist = [
'purchase_code',
'license',
];
private StripeService $stripe;
public function __construct(StripeService $stripe)
{
$this->stripe = $stripe;

View File

@@ -15,6 +15,10 @@ use App\Http\Requests\Payments\RegisterNewPaymentMethodRequest;
class PaymentMethodsController extends Controller
{
private StripeService $stripe;
private DemoService $demo;
public function __construct(StripeService $stripe)
{
$this->stripe = $stripe;

View File

@@ -277,7 +277,7 @@ function is_visitor($shared)
*
* @param $request
* @param $name
* @return string
* @return string|null
*/
function store_avatar($request, $name)
{
@@ -314,7 +314,7 @@ function store_avatar($request, $name)
*
* @param $request
* @param $name
* @return string
* @return string|null
*/
function store_system_image($request, $name)
{
@@ -511,7 +511,7 @@ function format_date($date, $format = '%d. %B. %Y, %H:%M')
/**
* Get file type from mimetype
*
* @param $file
* @param $file_mimetype
* @return string
*/
function get_file_type($file_mimetype)
@@ -519,25 +519,11 @@ function get_file_type($file_mimetype)
// Get mimetype from file
$mimetype = explode('/', $file_mimetype);
switch ($mimetype[0]) {
case 'image':
return 'image';
break;
case 'video':
return 'video';
break;
case 'audio':
return 'audio';
break;
default:
return 'file';
if (in_array($mimetype[0], ['image', 'video', 'audio'])) {
return $mimetype[0];
}
return 'file';
}
/**
@@ -591,7 +577,7 @@ function get_pretty_name($basename, $name, $mimetype)
* Get exif data from jpeg image
*
* @param $file
* @return array
* @return array|null
*/
function get_image_meta_data($file)
{
@@ -859,10 +845,9 @@ function set_time_by_user_timezone($time)
$user = Auth::user();
if ($user) {
// Get the value of timezone if user have some
$time_zone = intval($user->settings->timezone * 60 ?? null);
return Carbon::parse($time)->addMinutes($time_zone ?? null);
return Carbon::parse($time)->addMinutes($time_zone ?? 0);
}
return Carbon::parse($time);

View File

@@ -74,7 +74,7 @@ class File extends Model
/**
* Form\a\t created at date reformat
*
* @return string
* @return string|null
*/
public function getDeletedAtAttribute()
{
@@ -98,7 +98,7 @@ class File extends Model
/**
* Format thumbnail url
*
* @return string
* @return string|null
*/
public function getThumbnailAttribute()
{

View File

@@ -109,7 +109,7 @@ class Folder extends Model
/**
* Format created at date reformat
*
* @return string
* @return string|null
*/
public function getDeletedAtAttribute()
{

View File

@@ -6,6 +6,9 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
* @method static whereNotNull(string $string)
*/
class Share extends Model
{
use Notifiable, HasFactory;

View File

@@ -9,10 +9,12 @@ class ResetPassword extends Notification
{
use Queueable;
private $token;
/**
* Create a new notification instance.
*
* @return void
* @param $token
*/
public function __construct($token)
{

View File

@@ -18,7 +18,7 @@ class SchedulerService
->get()
->each(function ($zip) {
// Delete zip file
\Storage::disk('local')->delete("zip/$zip->basename");
Storage::disk('local')->delete("zip/$zip->basename");
// Delete zip record
$zip->delete();

View File

@@ -13,6 +13,8 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class StripeService
{
private \Cartalyst\Stripe\Stripe $stripe;
/**
* Stripe Service constructor.
*/
@@ -115,9 +117,8 @@ class StripeService
*
* @param $request
* @param $user
* @return mixed
*/
public function registerNewPaymentMethod($request, $user)
public function registerNewPaymentMethod($request, $user): void
{
// Clear cached payment methods
cache_forget_many([
@@ -139,10 +140,8 @@ class StripeService
*
* @param $request
* @param $user
* @param $paymentMethod
* @return \Illuminate\Http\RedirectResponse
*/
public function createOrReplaceSubscription($request, $user)
public function createOrReplaceSubscription($request, $user): void
{
try {
// Get payment method