Skip to content

Commit d3a0b7d

Browse files
freekmurzegithub-actions[bot]
authored andcommitted
Fix styling
1 parent 0197696 commit d3a0b7d

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

configure.php

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env php
22
<?php
33

4-
function ask(string $question, string $default = ''): string {
5-
$answer = readline($question . ($default ? " ({$default})" : null) . ': ');
4+
function ask(string $question, string $default = ''): string
5+
{
6+
$answer = readline($question.($default ? " ({$default})" : null).': ');
67

78
if (! $answer) {
89
return $default;
@@ -11,8 +12,9 @@ function ask(string $question, string $default = ''): string {
1112
return $answer;
1213
}
1314

14-
function confirm(string $question, bool $default = false): bool {
15-
$answer = ask($question . ' (' . ($default ? 'Y/n' : 'y/N') . ')');
15+
function confirm(string $question, bool $default = false): bool
16+
{
17+
$answer = ask($question.' ('.($default ? 'Y/n' : 'y/N').')');
1618

1719
if (! $answer) {
1820
return $default;
@@ -21,15 +23,18 @@ function confirm(string $question, bool $default = false): bool {
2123
return strtolower($answer) === 'y';
2224
}
2325

24-
function writeln(string $line): void {
25-
echo $line . PHP_EOL;
26+
function writeln(string $line): void
27+
{
28+
echo $line.PHP_EOL;
2629
}
2730

28-
function run(string $command): string {
31+
function run(string $command): string
32+
{
2933
return trim(shell_exec($command));
3034
}
3135

32-
function str_after(string $subject, string $search): string {
36+
function str_after(string $subject, string $search): string
37+
{
3338
$pos = strrpos($subject, $search);
3439

3540
if ($pos === false) {
@@ -39,15 +44,18 @@ function str_after(string $subject, string $search): string {
3944
return substr($subject, $pos + strlen($search));
4045
}
4146

42-
function slugify(string $subject): string {
47+
function slugify(string $subject): string
48+
{
4349
return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $subject), '-'));
4450
}
4551

46-
function title_case(string $subject): string {
52+
function title_case(string $subject): string
53+
{
4754
return str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $subject)));
4855
}
4956

50-
function replace_in_file(string $file, array $replacements): void {
57+
function replace_in_file(string $file, array $replacements): void
58+
{
5159
$contents = file_get_contents($file);
5260

5361
file_put_contents(
@@ -60,7 +68,8 @@ function replace_in_file(string $file, array $replacements): void {
6068
);
6169
}
6270

63-
function removeReadmeParagraphs(string $file): void {
71+
function removeReadmeParagraphs(string $file): void
72+
{
6473
$contents = file_get_contents($file);
6574

6675
file_put_contents(
@@ -69,16 +78,19 @@ function removeReadmeParagraphs(string $file): void {
6978
);
7079
}
7180

72-
function determineSeparator(string $path): string {
81+
function determineSeparator(string $path): string
82+
{
7383
return str_replace('/', DIRECTORY_SEPARATOR, $path);
7484
}
7585

76-
function replaceForWindows(): array {
86+
function replaceForWindows(): array
87+
{
7788
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 vendor_name vendor_slug [email protected]"'));
7889
}
7990

80-
function replaceForAllOtherOSes(): array {
81-
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|[email protected]" --exclude-dir=vendor ./* ./.github/* | grep -v ' . basename(__FILE__)));
91+
function replaceForAllOtherOSes(): array
92+
{
93+
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|[email protected]" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__)));
8294
}
8395

8496
$gitName = run('git config user.name');
@@ -138,11 +150,10 @@ function replaceForAllOtherOSes(): array {
138150
]);
139151

140152
match (true) {
141-
str_contains($file, determineSeparator('src/SkeletonClass.php')) => rename($file, determineSeparator('./src/' . $className . 'Class.php')),
153+
str_contains($file, determineSeparator('src/SkeletonClass.php')) => rename($file, determineSeparator('./src/'.$className.'Class.php')),
142154
str_contains($file, 'README.md') => removeReadmeParagraphs($file),
143155
default => [],
144156
};
145-
146157
}
147158

148159
confirm('Execute `composer install` and run tests?') && run('composer install && composer test');

0 commit comments

Comments
 (0)