mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Applied code style rules to src/
This commit is contained in:
parent
700c049d26
commit
f861de791f
186 changed files with 1462 additions and 1059 deletions
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -51,7 +54,7 @@ class CleanAttachmentsCommand extends Command
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDescription('Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')
|
||||
|
@ -59,7 +62,7 @@ class CleanAttachmentsCommand extends Command
|
|||
' These files are not needed and can eventually deleted.');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
|
@ -84,7 +87,7 @@ class CleanAttachmentsCommand extends Command
|
|||
|
||||
foreach ($finder as $file) {
|
||||
//If not attachment object uses this file, print it
|
||||
if (0 == \count($this->reverseSearch->findAttachmentsByFile($file))) {
|
||||
if (0 === \count($this->reverseSearch->findAttachmentsByFile($file))) {
|
||||
$file_list[] = $file;
|
||||
$table->addRow([
|
||||
$fs->makePathRelative($file->getPathname(), $mediaPath),
|
||||
|
@ -99,7 +102,7 @@ class CleanAttachmentsCommand extends Command
|
|||
|
||||
$continue = $io->confirm(sprintf('Found %d abandoned files. Do you want to delete them? This can not be undone!', \count($file_list)), false);
|
||||
|
||||
if (!$continue) {
|
||||
if (! $continue) {
|
||||
//We are finished here, when no files should be deleted
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -67,7 +70,7 @@ class ConvertBBCodeCommand extends Command
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDescription('Converts BBCode used in old Part-DB versions to newly used Markdown')
|
||||
|
@ -97,7 +100,7 @@ class ConvertBBCodeCommand extends Command
|
|||
];
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$targets = $this->getTargetsLists();
|
||||
|
@ -126,7 +129,7 @@ class ConvertBBCodeCommand extends Command
|
|||
|
||||
//In verbose mode print the names of the entities
|
||||
foreach ($results as $result) {
|
||||
/* @var NamedDBElement $result */
|
||||
/** @var NamedDBElement $result */
|
||||
$io->writeln(
|
||||
'Convert entity: '.$result->getName().' ('.$result->getIDString().')',
|
||||
OutputInterface::VERBOSITY_VERBOSE
|
||||
|
@ -135,7 +138,7 @@ class ConvertBBCodeCommand extends Command
|
|||
//Retrieve bbcode from entity
|
||||
$bbcode = $this->propertyAccessor->getValue($result, $property);
|
||||
//Check if the current property really contains BBCode
|
||||
if (!preg_match(static::BBCODE_REGEX, $bbcode)) {
|
||||
if (! preg_match(static::BBCODE_REGEX, $bbcode)) {
|
||||
continue;
|
||||
}
|
||||
$io->writeln(
|
||||
|
@ -156,7 +159,7 @@ class ConvertBBCodeCommand extends Command
|
|||
}
|
||||
|
||||
//If we are not in dry run, save changes to DB
|
||||
if (!$input->getOption('dry-run')) {
|
||||
if (! $input->getOption('dry-run')) {
|
||||
$this->em->flush();
|
||||
$io->success('Changes saved to DB successfully!');
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -45,7 +48,7 @@ class SetPasswordCommand extends Command
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDescription('Sets the password of a user')
|
||||
|
@ -54,18 +57,16 @@ class SetPasswordCommand extends Command
|
|||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$user_name = $input->getArgument('user');
|
||||
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
/** @var User */
|
||||
$users = $this->entityManager->getRepository(User::class)->findBy(['name' => $user_name]);
|
||||
$user = $users[0];
|
||||
|
||||
if (null == $user) {
|
||||
if (null === $user) {
|
||||
$io->error(sprintf('No user with the given username %s found in the database!', $user_name));
|
||||
|
||||
return;
|
||||
|
@ -77,14 +78,14 @@ class SetPasswordCommand extends Command
|
|||
sprintf('You are going to change the password of %s with ID %d. Proceed?',
|
||||
$user->getFullName(true), $user->getID()));
|
||||
|
||||
if (!$proceed) {
|
||||
if (! $proceed) {
|
||||
return;
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$new_password = '';
|
||||
|
||||
while (!$success) {
|
||||
while (! $success) {
|
||||
$pw1 = $io->askHidden('Please enter new password:');
|
||||
$pw2 = $io->askHidden('Please confirm:');
|
||||
if ($pw1 !== $pw2) {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -49,7 +52,7 @@ class UpdateExchangeRatesCommand extends Command
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDescription('Updates the currency exchange rates.')
|
||||
|
@ -62,7 +65,7 @@ class UpdateExchangeRatesCommand extends Command
|
|||
null);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
|
@ -88,7 +91,7 @@ class UpdateExchangeRatesCommand extends Command
|
|||
$repo = $this->em->getRepository(Currency::class);
|
||||
$candidates = [];
|
||||
|
||||
if (!empty($iso_code)) {
|
||||
if (! empty($iso_code)) {
|
||||
$candidates = $repo->findBy(['iso_code' => $iso_code]);
|
||||
} else {
|
||||
$candidates = $repo->findAll();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue