Skip to content

Commit ef8af71

Browse files
Format code with php-cs-fixer
This commit fixes the style issues introduced in 2ab3346 according to the output from php-cs-fixer. Details: https://deepsource.io/gh/FriendsOfShopware/FroshTools/transform/4682858e-f530-4e1a-9473-7194aa3a6731/
1 parent 2ab3346 commit ef8af71

32 files changed

Lines changed: 134 additions & 126 deletions

src/Command/DevRobotsTxtCommand.php

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\Tools\Command;
44

55
use Symfony\Component\Console\Command\Command;
66
use Symfony\Component\Console\Input\InputInterface;
7+
use Symfony\Component\Console\Input\InputOption;
78
use Symfony\Component\Console\Output\OutputInterface;
89
use Symfony\Component\Console\Style\SymfonyStyle;
9-
use Symfony\Component\Console\Input\InputOption;
1010

1111
class DevRobotsTxtCommand extends Command
1212
{
@@ -28,26 +28,27 @@ protected function configure(): void
2828
protected function execute(InputInterface $input, OutputInterface $output): int
2929
{
3030
$io = new SymfonyStyle($input, $output);
31-
$robotsPath = $this->envPath."/robots.txt";
31+
$robotsPath = $this->envPath . '/robots.txt';
3232
$originalState = $input->getOption('remove');
3333
$fileExists = file_exists($robotsPath);
3434

35-
//robots.txt exists in public folder
36-
if($fileExists) {
37-
if($originalState) {
35+
// robots.txt exists in public folder
36+
if ($fileExists) {
37+
if ($originalState) {
3838
return $this->revertToOriginal($input, $output, $robotsPath);
3939
}
4040

4141
return $this->changeRobotsTxt($input, $output, $robotsPath);
4242
}
43-
44-
//robots.txt does not exist in public folder
45-
if($originalState) {
43+
44+
// robots.txt does not exist in public folder
45+
if ($originalState) {
4646
$io->error('There is no robots.txt in public folder');
47+
4748
return self::SUCCESS;
4849
}
4950

50-
$robotsFile = fopen($robotsPath, "w");
51+
$robotsFile = fopen($robotsPath, 'w');
5152
$robotsContent = "#soc\nUser-agent: *\nDisallow: /\n#eoc";
5253
fwrite($robotsFile, $robotsContent);
5354
fclose($robotsFile);
@@ -57,46 +58,50 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5758
return self::SUCCESS;
5859
}
5960

60-
private function revertToOriginal($input, $output, $robotsPath): int
61+
private function revertToOriginal($input, $output, $robotsPath): int
6162
{
62-
//returns robots.txt to original state
63+
// returns robots.txt to original state
6364
$io = new SymfonyStyle($input, $output);
6465
$file = file_get_contents($robotsPath);
6566
$createdString = "#soc\nUser-agent: *\nDisallow: /\n#eoc";
6667

67-
//If only input from command is present
68-
if($file === $createdString) {
68+
// If only input from command is present
69+
if ($file === $createdString) {
6970
unlink($robotsPath);
7071
$io->success('robots.txt file deleted :)');
72+
7173
return self::SUCCESS;
7274
}
7375

74-
//removes everything between #soc & #eoc
76+
// removes everything between #soc & #eoc
7577
$content = preg_replace('/#soc[\s\S]+?#eoc/', '', $file);
7678

7779
file_put_contents($robotsPath, $content);
7880
$io->success('robots.txt reverted to original :)');
81+
7982
return self::SUCCESS;
8083
}
8184

82-
private function changeRobotsTxt(InputInterface $input, OutputInterface $output, string $robotsPath): int
85+
private function changeRobotsTxt(InputInterface $input, OutputInterface $output, string $robotsPath): int
8386
{
84-
//change robots.txt to disable crawlers
87+
// change robots.txt to disable crawlers
8588
$io = new SymfonyStyle($input, $output);
8689

8790
$file = file_get_contents($robotsPath);
8891
$commandString = "#soc\nUser-agent: *\nDisallow: /\n#eoc";
8992

90-
//If command is called multiple times
91-
if(str_contains($file, $commandString)) {
93+
// If command is called multiple times
94+
if (str_contains($file, $commandString)) {
9295
$io->error('Command was already executed before');
93-
return self::SUCCESS;
96+
97+
return self::SUCCESS;
9498
}
9599

96-
$content = "#soc\nUser-agent: *\nDisallow: /\n#eoc\n".$file;
100+
$content = "#soc\nUser-agent: *\nDisallow: /\n#eoc\n" . $file;
97101
file_put_contents($robotsPath, $content);
98102

99103
$io->success('robots.txt changed :)');
104+
100105
return self::SUCCESS;
106+
}
101107
}
102-
}

src/Command/EnvDelCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\Tools\Command;
44

src/Command/EnvGetCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\Tools\Command;
44

@@ -40,8 +40,8 @@ public function execute(InputInterface $input, OutputInterface $output): int
4040

4141
if ($input->getArgument('variable') === null) {
4242
if ($mode === 'json') {
43-
$output->writeln(json_encode($file->values(), JSON_PRETTY_PRINT));
44-
} else if ($mode) {
43+
$output->writeln(json_encode($file->values(), \JSON_PRETTY_PRINT));
44+
} elseif ($mode) {
4545
$output->writeln($file->__toString());
4646
}
4747

@@ -55,8 +55,8 @@ public function execute(InputInterface $input, OutputInterface $output): int
5555
}
5656

5757
if ($mode === 'json') {
58-
$output->writeln(json_encode([$var->getKey() => $var->getValue()], JSON_PRETTY_PRINT));
59-
} else if ($mode === 'kv') {
58+
$output->writeln(json_encode([$var->getKey() => $var->getValue()], \JSON_PRETTY_PRINT));
59+
} elseif ($mode === 'kv') {
6060
$output->writeln($var->getLine());
6161
} else {
6262
$output->writeln($var->getValue());

src/Command/EnvListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\Tools\Command;
44

src/Command/EnvSetCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\Tools\Command;
44

src/Command/UpdateComposerPluginsCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3636
$plugins = $this->pluginLoader->getPluginInfos();
3737

3838
$composerNames = [];
39-
foreach($plugins as $plugin) {
39+
foreach ($plugins as $plugin) {
4040
if ($plugin['managedByComposer'] === true) {
4141
$composerNames[] = $plugin['composerName'];
4242
}
@@ -48,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4848
'command' => 'outdated',
4949
'--working-dir' => $this->projectDir,
5050
'--direct' => null,
51-
'--format' => 'json'
51+
'--format' => 'json',
5252
]
5353
);
5454

@@ -59,6 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5959

6060
if (!isset($packages['installed'])) {
6161
$io->error('No installed composer packages found!');
62+
6263
return self::FAILURE;
6364
}
6465

@@ -104,6 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
104105
}
105106

106107
$io->success('Finished!');
108+
107109
return self::SUCCESS;
108110
}
109111
}

src/Command/UpdatePluginsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6363
$pluginUpdate = new ArrayInput([
6464
'command' => 'plugin:update',
6565
'plugins' => $upgradablePlugins,
66-
'-n'
66+
'-n',
6767
]);
6868
$application->run($pluginUpdate);
6969

src/Components/CacheAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getSize(): int
3535
return CacheHelper::getSize($this->getPathOfFilesAdapter($this->adapter));
3636
case $this->adapter instanceof ApcuAdapter:
3737
$aPCUIterator = new APCUIterator();
38+
3839
return $aPCUIterator->getTotalSize();
3940
}
4041

src/Components/CacheRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\Tools\Components;
44

src/Components/Elasticsearch/ElasticsearchManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\Tools\Components\Elasticsearch;
44

@@ -52,7 +52,7 @@ public function info(): array
5252
{
5353
return [
5454
'info' => $this->client->info(),
55-
'health' => $this->client->cluster()->health()
55+
'health' => $this->client->cluster()->health(),
5656
];
5757
}
5858

@@ -87,7 +87,7 @@ public function proxy(string $method, string $path, array $params, array $body):
8787
if ($body === []) {
8888
$body = null;
8989
}
90-
90+
9191
$response = $this->client->transport->performRequest($method, $path, $params, $body);
9292

9393
return $this->client->transport->resultOrFuture($response);

0 commit comments

Comments
 (0)