Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply and enforce PSR-12 #160

Merged
merged 2 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions app/Console/Commands/BudgetInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;

class BudgetInstall extends Command {
class BudgetInstall extends Command
{
protected $signature = 'budget:install';

protected $description = 'Runs most of the commands needed to make Budget work';

public function __construct() {
public function __construct()
{
parent::__construct();
}

public function executeCommand($command) {
public function executeCommand($command)
{
$process = new Process($command);
$process->run();

Expand All @@ -27,25 +30,30 @@ public function executeCommand($command) {
echo $process->getOutput();
}

public function composerInstall() {
public function composerInstall()
{
$this->executeCommand(['composer', 'install', '--no-dev']);
}

public function yarnInstall() {
public function yarnInstall()
{
$this->executeCommand(['yarn', 'install']);
}

public function artisanPrepare() {
public function artisanPrepare()
{
$this->executeCommand(['cp', '.env.example', '.env']);
$this->executeCommand(['php', 'artisan', 'key:generate']);
$this->executeCommand(['php', 'artisan', 'storage:link']);
}

public function yarnBuild() {
public function yarnBuild()
{
$this->executeCommand(['yarn', 'run', 'development']);
}

public function handle() {
public function handle()
{
$this->composerInstall();
$this->yarnInstall();
$this->artisanPrepare();
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ protected function schedule(Schedule $schedule)
// $schedule->command('inspire')
// ->hourly();

$schedule->job(new ProcessRecurrings)->daily();
$schedule->job(new ProcessRecurrings())->daily();

$schedule->job(new SendWeeklyReports)->weekly()->fridays()->at('21:00');
$schedule->job(new SendWeeklyReports())->weekly()->fridays()->at('21:00');
}

/**
Expand All @@ -41,7 +41,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__ . '/Commands');

require base_path('routes/console.php');
}
Expand Down
10 changes: 7 additions & 3 deletions app/Events/ImportCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class ImportCreated {
use Dispatchable, InteractsWithSockets, SerializesModels;
class ImportCreated
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct(Import $import) {
public function __construct(Import $import)
{
Activity::create([
'space_id' => $import->space_id,
'user_id' => Auth::user()->id,
Expand Down
10 changes: 7 additions & 3 deletions app/Events/ImportDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class ImportDeleted {
use Dispatchable, InteractsWithSockets, SerializesModels;
class ImportDeleted
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct(Import $import) {
public function __construct(Import $import)
{
Activity::create([
'space_id' => $import->space_id,
'user_id' => Auth::user()->id,
Expand Down
10 changes: 7 additions & 3 deletions app/Events/RecurringCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class RecurringCreated {
use Dispatchable, InteractsWithSockets, SerializesModels;
class RecurringCreated
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct(Recurring $recurring) {
public function __construct(Recurring $recurring)
{
$userId = null;

if (Auth::check()) {
Expand Down
10 changes: 7 additions & 3 deletions app/Events/RecurringDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class RecurringDeleted {
use Dispatchable, InteractsWithSockets, SerializesModels;
class RecurringDeleted
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct(Recurring $recurring) {
public function __construct(Recurring $recurring)
{
$userId = null;

if (Auth::check()) {
Expand Down
10 changes: 7 additions & 3 deletions app/Events/TagCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class TagCreated {
use Dispatchable, InteractsWithSockets, SerializesModels;
class TagCreated
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct(Tag $tag) {
public function __construct(Tag $tag)
{
$userId = null;

if (Auth::check()) {
Expand Down
10 changes: 7 additions & 3 deletions app/Events/TagDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class TagDeleted {
use Dispatchable, InteractsWithSockets, SerializesModels;
class TagDeleted
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct(Tag $tag) {
public function __construct(Tag $tag)
{
$userId = null;

if (Auth::check()) {
Expand Down
12 changes: 8 additions & 4 deletions app/Events/TransactionCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class TransactionCreated {
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct($transaction) {
class TransactionCreated
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct($transaction)
{
$userId = null;

if (Auth::check()) {
Expand Down
12 changes: 8 additions & 4 deletions app/Events/TransactionDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Facades\Auth;

class TransactionDeleted {
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct($transaction) {
class TransactionDeleted
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

public function __construct($transaction)
{
$userId = null;

if (Auth::check()) {
Expand Down
3 changes: 2 additions & 1 deletion app/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace App;

class Helper {
class Helper
{
public static function formatNumber($number): string
{
return number_format($number, 2, '.', '');
Expand Down
6 changes: 4 additions & 2 deletions app/Http/Controllers/ActivityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use Illuminate\Http\Request;

class ActivityController extends Controller {
public function index() {
class ActivityController extends Controller
{
public function index()
{
return view('activities.index', [
'activities' => session('space')->activities()->latest()->get()
]);
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class ForgotPasswordController extends Controller
{
use SendsPasswordResetEmails;

/*
|--------------------------------------------------------------------------
| Password Reset Controller
Expand All @@ -18,8 +20,6 @@ class ForgotPasswordController extends Controller
|
*/

use SendsPasswordResetEmails;

/**
* Create a new controller instance.
*
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class LoginController extends Controller
{
use AuthenticatesUsers;

/*
|--------------------------------------------------------------------------
| Login Controller
Expand All @@ -18,8 +20,6 @@ class LoginController extends Controller
|
*/

use AuthenticatesUsers;

/**
* Where to redirect users after login.
*
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

class RegisterController extends Controller
{
use RegistersUsers;

/*
|--------------------------------------------------------------------------
| Register Controller
Expand All @@ -20,8 +22,6 @@ class RegisterController extends Controller
|
*/

use RegistersUsers;

/**
* Where to redirect users after registration.
*
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class ResetPasswordController extends Controller
{
use ResetsPasswords;

/*
|--------------------------------------------------------------------------
| Password Reset Controller
Expand All @@ -18,8 +20,6 @@ class ResetPasswordController extends Controller
|
*/

use ResetsPasswords;

/**
* Where to redirect users after resetting their password.
*
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/VerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class VerificationController extends Controller
{
use VerifiesEmails;

/*
|--------------------------------------------------------------------------
| Email Verification Controller
Expand All @@ -19,8 +21,6 @@ class VerificationController extends Controller
|
*/

use VerifiesEmails;

/**
* Where to redirect users after verification.
*
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}
7 changes: 4 additions & 3 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
use App\Helper;
use App\Repositories\TagRepository;
use Illuminate\Http\Request;

use App\Models\Earning;
use App\Models\Recurring;
use App\Models\Spending;
use App\Repositories\DashboardRepository;
use Auth;
use DB;

class DashboardController extends Controller {
class DashboardController extends Controller
{
private $dashboardRepository;
private $tagRepository;

Expand All @@ -23,7 +23,8 @@ public function __construct(DashboardRepository $dashboardRepository, TagReposit
$this->tagRepository = $tagRepository;
}

public function __invoke() {
public function __invoke()
{
$space_id = session('space')->id;
$currentYear = date('Y');
$currentMonth = date('m');
Expand Down
Loading