Skip to content

Commit

Permalink
style: apply php-cs-fixer (#318)
Browse files Browse the repository at this point in the history
* style: update php-cs-fixer

* style: apply php-cs-fixer
  • Loading branch information
andreiio authored Apr 1, 2023
1 parent 98a2265 commit af4a0e4
Show file tree
Hide file tree
Showing 96 changed files with 808 additions and 821 deletions.
18 changes: 3 additions & 15 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,10 @@
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],

'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => ['return'],
],
'braces' => true,
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => ['method'],
],
'class_definition' => true,
'concat_space' => [
'spacing' => 'one',
],
Expand Down Expand Up @@ -96,8 +84,7 @@
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unreachable_default_argument_value' => true,
Expand Down Expand Up @@ -155,7 +142,7 @@
// php-cs-fixer 3: Changed options
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
'operators' => [],
],
'blank_line_before_statement' => [
'statements' => ['return'],
Expand Down Expand Up @@ -194,6 +181,7 @@
__DIR__ . '/app',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/lang',
__DIR__ . '/resources',
__DIR__ . '/routes',
__DIR__ . '/tests',
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/BlockMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function createViewComponent(): void
$content = $this->build(
base_path('stubs/blocks/view-component.stub'),
[
'class' => $this->getComponentName(),
'class' => $this->getComponentName(),
]
);

Expand All @@ -125,7 +125,7 @@ protected function createVueComponent(): void
$content = $this->build(
base_path('stubs/blocks/vue.stub'),
[
'name' => $this->getComponentName(kebabCase: true),
'name' => $this->getComponentName(kebabCase: true),
]
);

Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/CreateAdminCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public function handle()
$password = $this->getUserPassword();

User::create([
'name' => $name,
'email' => $email,
'name' => $name,
'email' => $email,
'password' => Hash::make($password),
'role' => 'admin',
'role' => 'admin',
]);

$this->info('The admin account was successfully created!');
Expand Down Expand Up @@ -136,7 +136,7 @@ private function validatePassword(?string $password, ?string $confirmation = nul
{
$validator = Validator::make(
[
'password' => $password,
'password' => $password,
'password_confirmation' => $confirmation,
],
[
Expand Down
18 changes: 9 additions & 9 deletions app/Console/Commands/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ protected function seedLanguages(): void

Language::insert([
[
'code' => 'ro',
'name' => 'Română',
'code' => 'ro',
'name' => 'Română',
'enabled' => true,
],
[
'code' => 'en',
'name' => 'English',
'code' => 'en',
'name' => 'English',
'enabled' => false,
],
]);
Expand Down Expand Up @@ -107,8 +107,8 @@ protected function seedPages(): void
if (\count($setting) === 2) {
Setting::create([
'section' => $setting[0],
'key' => $setting[1],
'value' => $page->id,
'key' => $setting[1],
'value' => $page->id,
]);
}
});
Expand All @@ -133,10 +133,10 @@ protected function seedAdministrator(): void
}

User::create([
'email' => $email,
'name' => 'Administrator',
'email' => $email,
'name' => 'Administrator',
'password' => Hash::make($password),
'role' => 'admin',
'role' => 'admin',
]);

$this->info('Successfully created administrator for ' . $email);
Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/UpdateTranslationsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ protected function updateEverything(): void
$values = collect($this->lines)
->map(fn (array $text, string $key) => [
'group' => '*',
'key' => $key,
'text' => json_encode($text),
'key' => $key,
'text' => json_encode($text),
])
->all();

Expand All @@ -101,8 +101,8 @@ protected function updateMissing(): void

$newLines->push([
'group' => '*',
'key' => $key,
'text' => json_encode($text),
'key' => $key,
'text' => json_encode($text),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Exports/FormSubmissionsExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function styles(Worksheet $sheet)
{
return [
// Style the first row as bold text.
1 => ['font' => ['bold' => true]],
1 => ['font' => ['bold' => true]],
];
}

Expand Down
18 changes: 9 additions & 9 deletions app/Http/Controllers/Admin/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public function __construct()
protected function resourceAbilityMap(): array
{
return [
'index' => 'viewAny',
'show' => 'view',
'create' => 'create',
'store' => 'create',
'duplicate' => 'update',
'edit' => 'update',
'update' => 'update',
'destroy' => 'delete',
'restore' => 'restore',
'index' => 'viewAny',
'show' => 'view',
'create' => 'create',
'store' => 'create',
'duplicate' => 'update',
'edit' => 'update',
'update' => 'update',
'destroy' => 'delete',
'restore' => 'restore',
'forceDelete' => 'forceDelete',
];
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/LanguageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function edit(Language $language): Response
{
return Inertia::render('Languages/Edit', [
'resource' => LanguageResource::make($language),
'source' => LanguageLine::getTranslationsForGroup(config('app.fallback_locale'), '*'),
'source' => LanguageLine::getTranslationsForGroup(config('app.fallback_locale'), '*'),
])->model(Language::class);
}

Expand Down
16 changes: 8 additions & 8 deletions app/Http/Controllers/Admin/MenuController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function index(): RedirectResponse
public function edit(string $location): Response
{
return Inertia::render('Menus/Edit', [
'location' => $location,
'location' => $location,
'collection' => new MenuItemCollection(
MenuItem::query()
->location($location)
Expand Down Expand Up @@ -62,13 +62,13 @@ protected function prepareItems(array $items, string $location, int $depth = 0):
return collect($items)
->map(function (array $item, int $index) use ($location, $depth) {
$prepared = [
'location' => $location,
'position' => $index + 1,
'label' => $item['label'],
'type' => $item['type'],
'url' => $item['type'] === 'external' ? ($item['url'] ?? null) : null,
'route' => $item['type'] === 'route' ? ($item['route'] ?? null) : null,
'children' => $this->prepareItems($item['children'] ?? [], $location, ++$depth),
'location' => $location,
'position' => $index + 1,
'label' => $item['label'],
'type' => $item['type'],
'url' => $item['type'] === 'external' ? ($item['url'] ?? null) : null,
'route' => $item['type'] === 'route' ? ($item['route'] ?? null) : null,
'children' => $this->prepareItems($item['children'] ?? [], $location, ++$depth),
];

if (MenuItem::allowedModels()->has($item['type'])) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/PersonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function store(PersonRequest $request): RedirectResponse
public function edit(Person $person): Response
{
return Inertia::render('People/Edit', [
'resource' => PersonResource::make($person),
'resource' => PersonResource::make($person),
'platforms' => config('website-factory.social_platforms', []),
])->model(Person::class);
}
Expand Down
18 changes: 9 additions & 9 deletions app/Http/Controllers/Admin/SettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function index(): RedirectResponse
public function edit(string $section): Response
{
return Inertia::render('Settings/' . Str::studly($section), [
'section' => $section,
'section' => $section,
'sections' => Setting::sections(),
'settings' => Setting::section($section),
'data' => Setting::sectionData($section),
'data' => Setting::sectionData($section),
])->model(Setting::class);
}

Expand All @@ -49,9 +49,9 @@ public function store(string $section, SettingRequest $request): RedirectRespons
$settings = match ($section) {
'site' => $attributes->map(
fn ($value, $key) => match ($key) {
default => $value,
'logo' => $value?->storePubliclyAs('assets', 'logo.' . $value?->extension()),
'favicon' => $value
default => $value,
'logo' => $value?->storePubliclyAs('assets', 'logo.' . $value?->extension()),
'favicon' => $value
?->manipulate(function (Image $image) {
$image->fit(48, 48)->encode('png');
})
Expand All @@ -60,10 +60,10 @@ public function store(string $section, SettingRequest $request): RedirectRespons
),
'donations' => $attributes->map(
fn ($value, $key) => match ($key) {
default => $value,
'euplatesc_enabled' => \boolval($value),
default => $value,
'euplatesc_enabled' => \boolval($value),

'mobilpay_enabled' => \boolval($value),
'mobilpay_enabled' => \boolval($value),
'mobilpay_certificate' => encrypt($value?->get()),
'mobilpay_private_key' => encrypt($value?->get()),
}
Expand All @@ -76,7 +76,7 @@ public function store(string $section, SettingRequest $request): RedirectRespons
->each(
fn ($value, $key) => Setting::updateOrCreate(
[
'key' => $key,
'key' => $key,
'section' => $section,
],
[
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Front/DecisionAuthorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function show(string $locale, DecisionAuthor $decisionAuthor): View
->description($decisionAuthor->description);

return view('front.decisions.category', [
'category' => $decisionAuthor,
'category' => $decisionAuthor,
'decisions' => $decisionAuthor
->decisions()
->latest('published_at')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Front/DecisionCategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function show(string $locale, DecisionCategory $decisionCategory): View
->description($decisionCategory->description);

return view('front.decisions.category', [
'category' => $decisionCategory,
'category' => $decisionCategory,
'decisions' => $decisionCategory
->decisions()
->latest('published_at')
Expand Down
18 changes: 9 additions & 9 deletions app/Http/Controllers/Front/DonationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ public function submit(string $locale, DonationRequest $request)
abort_unless(PaymentGateway::isActive($attributes['gateway']), 403);

$response = PaymentGateway::purchase($attributes['gateway'], [
'amount' => $attributes['amount'] ?? $attributes['other'],
'currency' => $attributes['currency'],
'transactionId' => (string) time(),
'amount' => $attributes['amount'] ?? $attributes['other'],
'currency' => $attributes['currency'],
'transactionId' => (string) time(),
'transactionReference' => __('donation'),
'returnUrl' => localized_route('front.donations.return'),
'card' => [
'returnUrl' => localized_route('front.donations.return'),
'card' => [
'first_name' => $attributes['first_name'],
'last_name' => $attributes['last_name'],
'email' => $attributes['email'],
'phone' => $attributes['phone'],
'last_name' => $attributes['last_name'],
'email' => $attributes['email'],
'phone' => $attributes['phone'],
],
'recurring' => (bool) $attributes['recurring'],
'recurring' => (bool) $attributes['recurring'],
]);

if ($response->isSuccessful()) {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Front/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function index(): View
->image($image?->getUrl());

return view('front.pages.show', [
'page' => $page,
'page' => $page,
'image' => $image,
]);
}
Expand All @@ -51,7 +51,7 @@ public function show(string $locale, Page $page): RedirectResponse|View
$page->loadMissing('blocks.media');

return view('front.pages.show', [
'page' => $page,
'page' => $page,
'image' => $image,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Front/PersonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function show(string $locale, Person $person): View

return view('front.people.show', [
'person' => $person,
'image' => $image,
'image' => $image,
]);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Front/PostCategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function show(string $locale, PostCategory $postCategory): View

return view('front.posts.category', [
'category' => $postCategory,
'posts' => $postCategory
'posts' => $postCategory
->posts()
->with(['categories', 'media'])
->latest('published_at')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Front/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function show(string $locale, Post $post): View
->image($image?->getUrl());

return view('front.posts.show', [
'post' => $post,
'post' => $post,
'image' => $image,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Front/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __invoke(SearchRequest $request)
return response()
->view('front.search.results', [
'query' => $attributes['query'],
'type' => $attributes['type'],
'type' => $attributes['type'],
'types' => $this->getAvailableTypes(),
'items' => $this->search($attributes['query'], $attributes['type']),
])
Expand Down
Loading

0 comments on commit af4a0e4

Please sign in to comment.