Skip to content

Commit 7e12292

Browse files
committed
chore: format project
1 parent 3844b58 commit 7e12292

16 files changed

+95
-96
lines changed

configure.php

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@
4545
writeln('------');
4646
writeln("Author : \e[0;36m$authorName ($authorUsername, $authorEmail)\e[0m");
4747
writeln("Vendor : \e[0;36m$vendorName ($vendorSlug)\e[0m");
48-
writeln('Package : '."\e[0;36m".$packageSlug.($description ? " <{$description}>" : '')."\e[0m");
48+
writeln('Package : ' . "\e[0;36m" . $packageSlug . ($description ? " <{$description}>" : '') . "\e[0m");
4949
writeln("Namespace : \e[0;36m$vendorNamespace\\$className\e[0m");
5050
writeln("Class name : \e[0;36m$className\e[0m");
5151
writeln('---');
5252
writeln("\e[1;37mPackages & Utilities\e[0m");
53-
writeln('Larastan/PhpStan : '.($usePhpStan ? "\e[0;32mYes" : "\e[0;31mNo")."\e[0m");
54-
writeln('Pint : '.($usePint ? "\e[0;32mYes" : "\e[0;31mNo")."\e[0m");
55-
writeln('Use Dependabot : '.($useDependabot ? "\e[0;32mYes" : "\e[0;31mNo")."\e[0m");
56-
writeln('Use Ray : '.($useLaravelRay ? "\e[0;32mYes" : "\e[0;31mNo")."\e[0m");
57-
writeln('Auto-Changelog : '.($useUpdateChangelogWorkflow ? "\e[0;32mYes" : "\e[0;31mNo")."\e[0m");
53+
writeln('Larastan/PhpStan : ' . ($usePhpStan ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
54+
writeln('Pint : ' . ($usePint ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
55+
writeln('Use Dependabot : ' . ($useDependabot ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
56+
writeln('Use Ray : ' . ($useLaravelRay ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
57+
writeln('Auto-Changelog : ' . ($useUpdateChangelogWorkflow ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
5858
if ($formsOnly) {
5959
writeln("Filament/Forms : \e[0;32mYes\e[0m");
6060
} elseif ($tablesOnly) {
@@ -72,41 +72,41 @@
7272
}
7373

7474
if ($formsOnly) {
75-
safeUnlink(__DIR__.'/src/SkeletonTheme.php');
76-
safeUnlink(__DIR__.'/src/SkeletonPlugin.php');
75+
safeUnlink(__DIR__ . '/src/SkeletonTheme.php');
76+
safeUnlink(__DIR__ . '/src/SkeletonPlugin.php');
7777

7878
removeComposerDeps([
7979
'filament/filament',
8080
'filament/tables',
8181
], 'require');
8282
} elseif ($tablesOnly) {
83-
safeUnlink(__DIR__.'/src/SkeletonTheme.php');
84-
safeUnlink(__DIR__.'/src/SkeletonPlugin.php');
83+
safeUnlink(__DIR__ . '/src/SkeletonTheme.php');
84+
safeUnlink(__DIR__ . '/src/SkeletonPlugin.php');
8585

8686
removeComposerDeps([
8787
'filament/filament',
8888
'filament/forms',
8989
], 'require');
9090
} else {
9191
if ($isTheme) {
92-
safeUnlink(__DIR__.'/src/SkeletonServiceProvider.php');
93-
safeUnlink(__DIR__.'/src/SkeletonPlugin.php');
94-
safeUnlink(__DIR__.'/src/Skeleton.php');
95-
removeDirectory(__DIR__.'/bin');
96-
removeDirectory(__DIR__.'/config');
97-
removeDirectory(__DIR__.'/database');
98-
removeDirectory(__DIR__.'/stubs');
99-
removeDirectory(__DIR__.'/resources/js');
100-
removeDirectory(__DIR__.'/resources/lang');
101-
removeDirectory(__DIR__.'/resources/views');
102-
removeDirectory(__DIR__.'/src/Commands');
103-
removeDirectory(__DIR__.'/src/Facades');
104-
removeDirectory(__DIR__.'/src/Testing');
92+
safeUnlink(__DIR__ . '/src/SkeletonServiceProvider.php');
93+
safeUnlink(__DIR__ . '/src/SkeletonPlugin.php');
94+
safeUnlink(__DIR__ . '/src/Skeleton.php');
95+
removeDirectory(__DIR__ . '/bin');
96+
removeDirectory(__DIR__ . '/config');
97+
removeDirectory(__DIR__ . '/database');
98+
removeDirectory(__DIR__ . '/stubs');
99+
removeDirectory(__DIR__ . '/resources/js');
100+
removeDirectory(__DIR__ . '/resources/lang');
101+
removeDirectory(__DIR__ . '/resources/views');
102+
removeDirectory(__DIR__ . '/src/Commands');
103+
removeDirectory(__DIR__ . '/src/Facades');
104+
removeDirectory(__DIR__ . '/src/Testing');
105105

106106
setupPackageJsonForTheme();
107107

108108
} else {
109-
safeUnlink(__DIR__.'/src/SkeletonTheme.php');
109+
safeUnlink(__DIR__ . '/src/SkeletonTheme.php');
110110
}
111111

112112
removeComposerDeps([
@@ -136,34 +136,34 @@
136136
]);
137137

138138
match (true) {
139-
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/'.$className.'.php')),
140-
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')),
141-
str_contains($file, determineSeparator('src/SkeletonTheme.php')) => rename($file, determineSeparator('./src/'.$className.(str_ends_with($className, 'Theme') ? '.php' : 'Theme.php'))),
142-
str_contains($file, determineSeparator('src/SkeletonPlugin.php')) => rename($file, determineSeparator('./src/'.$className.'Plugin.php')),
143-
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/'.$className.'.php')),
144-
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/'.$className.'Command.php')),
145-
str_contains($file, determineSeparator('src/Testing/TestsSkeleton.php')) => rename($file, determineSeparator('./src/Testing/Tests'.$className.'.php')),
146-
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.titleSnake($packageSlugWithoutPrefix).'_table.php.stub')),
147-
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/'.$packageSlugWithoutPrefix.'.php')),
148-
str_contains($file, determineSeparator('resources/lang/en/skeleton.php')) => rename($file, determineSeparator('./resources/lang/en/'.$packageSlugWithoutPrefix.'.php')),
139+
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/' . $className . '.php')),
140+
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/' . $className . 'ServiceProvider.php')),
141+
str_contains($file, determineSeparator('src/SkeletonTheme.php')) => rename($file, determineSeparator('./src/' . $className . (str_ends_with($className, 'Theme') ? '.php' : 'Theme.php'))),
142+
str_contains($file, determineSeparator('src/SkeletonPlugin.php')) => rename($file, determineSeparator('./src/' . $className . 'Plugin.php')),
143+
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/' . $className . '.php')),
144+
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/' . $className . 'Command.php')),
145+
str_contains($file, determineSeparator('src/Testing/TestsSkeleton.php')) => rename($file, determineSeparator('./src/Testing/Tests' . $className . '.php')),
146+
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_' . titleSnake($packageSlugWithoutPrefix) . '_table.php.stub')),
147+
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/' . $packageSlugWithoutPrefix . '.php')),
148+
str_contains($file, determineSeparator('resources/lang/en/skeleton.php')) => rename($file, determineSeparator('./resources/lang/en/' . $packageSlugWithoutPrefix . '.php')),
149149
str_contains($file, 'README.md') => removeTag($file, 'delete'),
150150
default => [],
151151
};
152152
}
153153

154154
if (! $useDependabot) {
155-
safeUnlink(__DIR__.'/.github/dependabot.yml');
156-
safeUnlink(__DIR__.'/.github/workflows/dependabot-auto-merge.yml');
155+
safeUnlink(__DIR__ . '/.github/dependabot.yml');
156+
safeUnlink(__DIR__ . '/.github/workflows/dependabot-auto-merge.yml');
157157
}
158158

159159
if (! $useLaravelRay) {
160160
removeComposerDeps(['spatie/laravel-ray'], 'require-dev');
161161
}
162162

163163
if (! $usePhpStan) {
164-
safeUnlink(__DIR__.'/phpstan.neon.dist');
165-
safeUnlink(__DIR__.'/phpstan-baseline.neon');
166-
safeUnlink(__DIR__.'/.github/workflows/phpstan.yml');
164+
safeUnlink(__DIR__ . '/phpstan.neon.dist');
165+
safeUnlink(__DIR__ . '/phpstan-baseline.neon');
166+
safeUnlink(__DIR__ . '/.github/workflows/phpstan.yml');
167167

168168
removeComposerDeps([
169169
'phpstan/extension-installer',
@@ -176,8 +176,8 @@
176176
}
177177

178178
if (! $usePint) {
179-
safeUnlink(__DIR__.'/.github/workflows/fix-php-code-style-issues.yml');
180-
safeUnlink(__DIR__.'/pint.json');
179+
safeUnlink(__DIR__ . '/.github/workflows/fix-php-code-style-issues.yml');
180+
safeUnlink(__DIR__ . '/pint.json');
181181

182182
removeComposerDeps([
183183
'laravel/pint',
@@ -187,7 +187,7 @@
187187
}
188188

189189
if (! $useUpdateChangelogWorkflow) {
190-
safeUnlink(__DIR__.'/.github/workflows/update-changelog.yml');
190+
safeUnlink(__DIR__ . '/.github/workflows/update-changelog.yml');
191191
}
192192

193193
confirm('Execute `composer install`?') && run('composer install');
@@ -199,7 +199,7 @@
199199
function ask(string $question, string $default = ''): string
200200
{
201201
$def = $default ? "\e[0;33m ($default)" : '';
202-
$answer = readline("\e[0;32m".$question.$def.": \e[0m");
202+
$answer = readline("\e[0;32m" . $question . $def . ": \e[0m");
203203

204204
if (! $answer) {
205205
return $default;
@@ -221,7 +221,7 @@ function confirm(string $question, bool $default = false): bool
221221

222222
function writeln(string $line): void
223223
{
224-
echo $line.PHP_EOL;
224+
echo $line . PHP_EOL;
225225
}
226226

227227
function run(string $command): string
@@ -269,28 +269,28 @@ function removePrefix(string $prefix, string $content): string
269269

270270
function removeComposerDeps(array $names, string $location): void
271271
{
272-
$data = json_decode(file_get_contents(__DIR__.'/composer.json'), true);
272+
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
273273

274274
foreach ($data[$location] as $name => $version) {
275275
if (in_array($name, $names, true)) {
276276
unset($data[$location][$name]);
277277
}
278278
}
279279

280-
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
280+
file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
281281
}
282282

283283
function removeNpmDeps(array $names, string $location): void
284284
{
285-
$data = json_decode(file_get_contents(__DIR__.'/package.json'), true);
285+
$data = json_decode(file_get_contents(__DIR__ . '/package.json'), true);
286286

287287
foreach ($data[$location] as $name => $version) {
288288
if (in_array($name, $names, true)) {
289289
unset($data[$location][$name]);
290290
}
291291
}
292292

293-
file_put_contents(__DIR__.'/package.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES |
293+
file_put_contents(__DIR__ . '/package.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES |
294294
JSON_UNESCAPED_UNICODE));
295295
}
296296

@@ -300,7 +300,7 @@ function removeTag(string $file, string $tag): void
300300

301301
file_put_contents(
302302
$file,
303-
preg_replace('/<!--'.$tag.'-->.*<!--\/'.$tag.'-->/s', '', $contents) ?: $contents
303+
preg_replace('/<!--' . $tag . '-->.*<!--\/' . $tag . '-->/s', '', $contents) ?: $contents
304304
);
305305
}
306306

@@ -322,7 +322,7 @@ function setupPackageJsonForTheme(): void
322322
'prettier-plugin-tailwindcss',
323323
], 'devDependencies');
324324

325-
replaceInFile(__DIR__.'/package.json', [
325+
replaceInFile(__DIR__ . '/package.json', [
326326
'dev:styles' => 'dev',
327327
'build:styles' => 'build',
328328
]);
@@ -342,7 +342,7 @@ function determineSeparator(string $path): string
342342

343343
function replaceForWindows(): array
344344
{
345-
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i \\vendor\\ | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton migration_table_name vendor_name vendor_slug author@domain.com"'));
345+
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i \\vendor\\ | findstr /v /i ' . basename(__FILE__) . ' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton migration_table_name vendor_name vendor_slug author@domain.com"'));
346346
}
347347

348348
function replaceForAllOtherOSes(): array
@@ -358,10 +358,10 @@ function removeDirectory($dir): void
358358
$objects = scandir($dir);
359359
foreach ($objects as $object) {
360360
if ($object != '.' && $object != '..') {
361-
if (filetype($dir.'/'.$object) == 'dir') {
362-
removeDirectory($dir.'/'.$object);
361+
if (filetype($dir . '/' . $object) == 'dir') {
362+
removeDirectory($dir . '/' . $object);
363363
} else {
364-
unlink($dir.'/'.$object);
364+
unlink($dir . '/' . $object);
365365
}
366366
}
367367
}

src/Abstracts/BaseBlock.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static function generatedStorageUrl(string $path): string
3838
return Storage::url($path);
3939
}
4040

41-
public static function getUrlForFile(array|string|null $path = null): ?string
41+
public static function getUrlForFile(array | string | null $path = null): ?string
4242
{
4343
if (! $path) {
4444
return null;
@@ -71,7 +71,7 @@ public static function getView(): ?string
7171
return null;
7272
}
7373

74-
public static function getThumbnail(): string|Htmlable|null
74+
public static function getThumbnail(): string | Htmlable | null
7575
{
7676
return null;
7777
}
@@ -88,14 +88,14 @@ public static function getBlockLabel(array $state, ?int $index = null): mixed
8888
if ($key) {
8989
$label = data_get($state, $key);
9090
if ($label) {
91-
return static::getBlockName().' - '.$label.':';
91+
return static::getBlockName() . ' - ' . $label . ':';
9292
}
9393
}
9494

9595
if (is_null($index)) {
9696
return static::getBlockName();
9797
}
9898

99-
return static::getBlockName().' - '.($index + 1);
99+
return static::getBlockName() . ' - ' . ($index + 1);
100100
}
101101
}

src/Commands/CreatePageBuilderPluginBlockCategoryCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function handle(): int
3535

3636
$namespace = $this->getClassNameSpaces('BlockCategories');
3737

38-
$categoryClass = $namespace.'\\'.$categoryName;
38+
$categoryClass = $namespace . '\\' . $categoryName;
3939

4040
try {
4141
if (class_exists($categoryClass)) {

src/Commands/CreatePageBuilderPluginBlockCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function handle(): int
3939

4040
$blocksNamespace = $this->getClassNameSpaces('Blocks');
4141

42-
$blockClass = $blocksNamespace.'\\'.$block;
42+
$blockClass = $blocksNamespace . '\\' . $block;
4343

4444
try {
4545
if (class_exists($blockClass)) {

src/Components/Forms/Actions/SelectBlockAction.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ protected function setUp(): void
5454
->options($this->formatBlocksForSelect($component));
5555
} else {
5656
$field = Select::make('block_type')
57-
->native(false)
58-
->translateLabel()
59-
->disableOptionWhen(
60-
fn ($value) => (bool) $this->evaluate(Closure::fromCallable([$value, 'getIsSelectionDisabled'])),
61-
)
62-
->required()
63-
->translateLabel()
64-
->options($this->formatBlocksForSelect($component));
57+
->native(false)
58+
->translateLabel()
59+
->disableOptionWhen(
60+
fn ($value) => (bool) $this->evaluate(Closure::fromCallable([$value, 'getIsSelectionDisabled'])),
61+
)
62+
->required()
63+
->translateLabel()
64+
->options($this->formatBlocksForSelect($component));
6565
}
6666

6767
if ($this->modifySelectionFieldUsing) {
@@ -72,7 +72,7 @@ protected function setUp(): void
7272
}
7373

7474
return $form->schema([
75-
$field
75+
$field,
7676
]);
7777
});
7878

src/Components/Forms/RadioButtonImage.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@
1616
class RadioButtonImage extends Field
1717
{
1818
use CanDisableOptions;
19+
use FormatsBlockCategories;
1920
use HasExtraInputAttributes;
2021
use HasGridDirection;
2122
use HasOptions;
22-
use FormatsBlockCategories;
2323

2424
public string $view = 'page-builder-plugin::forms.radio-button-image';
2525

26-
public ComponentAttributeBag|Closure|null $allTabAttributes = null;
26+
public ComponentAttributeBag | Closure | null $allTabAttributes = null;
2727

2828
/**
2929
* Returns the thumbnail for the given block type.
3030
*
3131
* @param class-string<BaseBlock> $blockType
3232
* @return string|null
3333
*/
34-
public function getBlockThumbnail(string $blockType): string|Htmlable|null
34+
public function getBlockThumbnail(string $blockType): string | Htmlable | null
3535
{
3636
$closure = Closure::fromCallable([$blockType, 'getThumbnail']);
3737

3838
return $this->evaluate($closure) ?? null;
3939
}
4040

4141
public function allTabAttributes(
42-
ComponentAttributeBag|Closure $attributes = new ComponentAttributeBag()
42+
ComponentAttributeBag | Closure $attributes = new ComponentAttributeBag
4343
): static {
4444
$this->allTabAttributes = $attributes;
4545

@@ -48,7 +48,7 @@ public function allTabAttributes(
4848

4949
public function getAllTabAttributes(): ComponentAttributeBag
5050
{
51-
return $this->evaluate($this->allTabAttributes) ?? new ComponentAttributeBag();
51+
return $this->evaluate($this->allTabAttributes) ?? new ComponentAttributeBag;
5252
}
5353

5454
public function getFormattedOptions(): array

src/PageBuilderPluginServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function packageBooted(): void
7272

7373
// Handle Stubs
7474
if (app()->runningInConsole()) {
75-
foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) {
75+
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
7676
$this->publishes([
7777
$file->getRealPath() => base_path("stubs/page-builder-plugin/{$file->getFilename()}"),
7878
], 'page-builder-plugin-stubs');
@@ -94,7 +94,7 @@ protected function getAssetPackageName(): ?string
9494
protected function getAssets(): array
9595
{
9696
return [
97-
Css::make('page-builder-plugin-styles', __DIR__.'/../resources/dist/page-builder-plugin.css'),
97+
Css::make('page-builder-plugin-styles', __DIR__ . '/../resources/dist/page-builder-plugin.css'),
9898
];
9999
}
100100

0 commit comments

Comments
 (0)