mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-25 10:31:05 +00:00
Fix CS
This commit is contained in:
parent
bf329d34d8
commit
c6a69e595c
23 changed files with 57 additions and 57 deletions
|
@ -65,7 +65,7 @@ class CleanDownloadedImagesCommand extends Command
|
|||
$existingPaths[] = $file->getFilename();
|
||||
}
|
||||
|
||||
$io->text(sprintf(' -> <info>%d</info> images found', \count($existingPaths)));
|
||||
$io->text(\sprintf(' -> <info>%d</info> images found', \count($existingPaths)));
|
||||
|
||||
$io->text('Retrieve valid folders attached to a user');
|
||||
|
||||
|
@ -84,7 +84,7 @@ class CleanDownloadedImagesCommand extends Command
|
|||
$validPaths[] = explode('/', $path)[2];
|
||||
}
|
||||
|
||||
$io->text(sprintf(' -> <info>%d</info> folders found', \count($validPaths)));
|
||||
$io->text(\sprintf(' -> <info>%d</info> folders found', \count($validPaths)));
|
||||
|
||||
$deletedCount = 0;
|
||||
|
||||
|
@ -103,11 +103,11 @@ class CleanDownloadedImagesCommand extends Command
|
|||
|
||||
$deletedCount += \count($files);
|
||||
|
||||
$io->text(sprintf('Deleted images in <info>%s</info>: <info>%d</info>', $existingPath, \count($files)));
|
||||
$io->text(\sprintf('Deleted images in <info>%s</info>: <info>%d</info>', $existingPath, \count($files)));
|
||||
}
|
||||
}
|
||||
|
||||
$io->success(sprintf('Finished cleaning. %d deleted images', $deletedCount));
|
||||
$io->success(\sprintf('Finished cleaning. %d deleted images', $deletedCount));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class CleanDuplicatesCommand extends Command
|
|||
$user = $this->getUser($username);
|
||||
$this->cleanDuplicates($user);
|
||||
} catch (NoResultException $e) {
|
||||
$this->io->error(sprintf('User "%s" not found.', $username));
|
||||
$this->io->error(\sprintf('User "%s" not found.', $username));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -65,13 +65,13 @@ class CleanDuplicatesCommand extends Command
|
|||
} else {
|
||||
$users = $this->userRepository->findAll();
|
||||
|
||||
$this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
|
||||
$this->io->text(\sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
|
||||
|
||||
foreach ($users as $user) {
|
||||
$this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername()));
|
||||
$this->io->text(\sprintf('Processing user <info>%s</info>', $user->getUsername()));
|
||||
$this->cleanDuplicates($user);
|
||||
}
|
||||
$this->io->success(sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
|
||||
$this->io->success(\sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -99,7 +99,7 @@ class CleanDuplicatesCommand extends Command
|
|||
|
||||
$this->duplicates += $duplicatesCount;
|
||||
|
||||
$this->io->text(sprintf('Cleaned <info>%d</info> duplicates for user <info>%s</info>', $duplicatesCount, $user->getUserName()));
|
||||
$this->io->text(\sprintf('Cleaned <info>%d</info> duplicates for user <info>%s</info>', $duplicatesCount, $user->getUserName()));
|
||||
}
|
||||
|
||||
private function similarUrl($url)
|
||||
|
|
|
@ -56,7 +56,7 @@ class ExportCommand extends Command
|
|||
try {
|
||||
$user = $this->userRepository->findOneByUserName($input->getArgument('username'));
|
||||
} catch (NoResultException $e) {
|
||||
$io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
|
||||
$io->error(\sprintf('User "%s" not found.', $input->getArgument('username')));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -66,12 +66,12 @@ class ExportCommand extends Command
|
|||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
$io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName()));
|
||||
$io->text(\sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName()));
|
||||
|
||||
$filePath = $input->getArgument('filepath');
|
||||
|
||||
if (!$filePath) {
|
||||
$filePath = $this->projectDir . '/' . sprintf('%s-export.json', $user->getUsername());
|
||||
$filePath = $this->projectDir . '/' . \sprintf('%s-export.json', $user->getUsername());
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -82,7 +82,7 @@ class ExportCommand extends Command
|
|||
->exportJsonData();
|
||||
file_put_contents($filePath, $data);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$io->error(sprintf('Error: "%s"', $e->getMessage()));
|
||||
$io->error(\sprintf('Error: "%s"', $e->getMessage()));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -50,17 +50,17 @@ class GenerateUrlHashesCommand extends Command
|
|||
$user = $this->getUser($username);
|
||||
$this->generateHashedUrls($user);
|
||||
} catch (NoResultException $e) {
|
||||
$output->writeln(sprintf('<error>User "%s" not found.</error>', $username));
|
||||
$output->writeln(\sprintf('<error>User "%s" not found.</error>', $username));
|
||||
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
$users = $this->userRepository->findAll();
|
||||
|
||||
$output->writeln(sprintf('Generating hashed urls for "%d" users', \count($users)));
|
||||
$output->writeln(\sprintf('Generating hashed urls for "%d" users', \count($users)));
|
||||
|
||||
foreach ($users as $user) {
|
||||
$output->writeln(sprintf('Processing user: %s', $user->getUsername()));
|
||||
$output->writeln(\sprintf('Processing user: %s', $user->getUsername()));
|
||||
$this->generateHashedUrls($user);
|
||||
}
|
||||
$output->writeln('Finished generated hashed urls');
|
||||
|
@ -86,7 +86,7 @@ class GenerateUrlHashesCommand extends Command
|
|||
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->output->writeln(sprintf('Generated hashed urls for user: %s', $user->getUserName()));
|
||||
$this->output->writeln(\sprintf('Generated hashed urls for user: %s', $user->getUserName()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -98,7 +98,7 @@ class ImportCommand extends Command
|
|||
$output->writeln('Start : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---');
|
||||
|
||||
if (!file_exists($input->getArgument('filepath'))) {
|
||||
throw new Exception(sprintf('File "%s" not found', $input->getArgument('filepath')));
|
||||
throw new Exception(\sprintf('File "%s" not found', $input->getArgument('filepath')));
|
||||
}
|
||||
|
||||
// Turning off doctrine default logs queries for saving memory
|
||||
|
@ -115,7 +115,7 @@ class ImportCommand extends Command
|
|||
}
|
||||
|
||||
if (!\is_object($entityUser)) {
|
||||
throw new Exception(sprintf('User "%s" not found', $input->getArgument('username')));
|
||||
throw new Exception(\sprintf('User "%s" not found', $input->getArgument('username')));
|
||||
}
|
||||
|
||||
// Authenticate user for paywalled websites
|
||||
|
|
|
@ -41,7 +41,7 @@ class RedisWorkerCommand extends Command
|
|||
$serviceName = $input->getArgument('serviceName');
|
||||
|
||||
if (!$this->container->has('wallabag.queue.redis.' . $serviceName) || !$this->container->has('wallabag.consumer.redis.' . $serviceName)) {
|
||||
throw new Exception(sprintf('No queue or consumer found for service name: "%s"', $input->getArgument('serviceName')));
|
||||
throw new Exception(\sprintf('No queue or consumer found for service name: "%s"', $input->getArgument('serviceName')));
|
||||
}
|
||||
|
||||
$worker = new QueueWorker(
|
||||
|
|
|
@ -109,7 +109,7 @@ class InstallCommand extends Command
|
|||
$help = 'Database driver "' . $this->databaseDriver . '" is not installed.';
|
||||
}
|
||||
|
||||
$rows[] = [sprintf($label, $this->databaseDriver), $status, $help];
|
||||
$rows[] = [\sprintf($label, $this->databaseDriver), $status, $help];
|
||||
|
||||
// testing if connection to the database can be established
|
||||
$label = '<comment>Database connection</comment>';
|
||||
|
@ -388,12 +388,12 @@ class InstallCommand extends Command
|
|||
$schemaManager = $connection->createSchemaManager();
|
||||
} catch (\Exception $exception) {
|
||||
// mysql & sqlite
|
||||
if (str_contains($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
|
||||
if (str_contains($exception->getMessage(), \sprintf("Unknown database '%s'", $databaseName))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// pgsql
|
||||
if (str_contains($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
|
||||
if (str_contains($exception->getMessage(), \sprintf('database "%s" does not exist', $databaseName))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class ListUserCommand extends Command
|
|||
$io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows);
|
||||
|
||||
$io->success(
|
||||
sprintf(
|
||||
\sprintf(
|
||||
'%s/%s%s user(s) displayed.',
|
||||
\count($users),
|
||||
$nbUsers,
|
||||
|
|
|
@ -63,7 +63,7 @@ class ReloadEntryCommand extends Command
|
|||
->findOneByUserName($username)
|
||||
->getId();
|
||||
} catch (NoResultException $e) {
|
||||
$io->error(sprintf('User "%s" not found.', $username));
|
||||
$io->error(\sprintf('User "%s" not found.', $username));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class ReloadEntryCommand extends Command
|
|||
}
|
||||
|
||||
$io->note(
|
||||
sprintf(
|
||||
\sprintf(
|
||||
"You're going to reload %s entries. Depending on the number of entry to reload, this could be a very long process.",
|
||||
$nbEntries
|
||||
)
|
||||
|
|
|
@ -47,7 +47,7 @@ class ShowUserCommand extends Command
|
|||
$user = $this->getUser($username);
|
||||
$this->showUser($user);
|
||||
} catch (NoResultException $e) {
|
||||
$this->io->error(sprintf('User "%s" not found.', $username));
|
||||
$this->io->error(\sprintf('User "%s" not found.', $username));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -58,13 +58,13 @@ class ShowUserCommand extends Command
|
|||
private function showUser(User $user)
|
||||
{
|
||||
$this->io->listing([
|
||||
sprintf('Username: %s', $user->getUsername()),
|
||||
sprintf('Email: %s', $user->getEmail()),
|
||||
sprintf('Display name: %s', $user->getName()),
|
||||
sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
|
||||
sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
|
||||
sprintf('2FA (email) activated: %s', $user->isEmailTwoFactor() ? 'yes' : 'no'),
|
||||
sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'),
|
||||
\sprintf('Username: %s', $user->getUsername()),
|
||||
\sprintf('Email: %s', $user->getEmail()),
|
||||
\sprintf('Display name: %s', $user->getName()),
|
||||
\sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
|
||||
\sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
|
||||
\sprintf('2FA (email) activated: %s', $user->isEmailTwoFactor() ? 'yes' : 'no'),
|
||||
\sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,12 +49,12 @@ class TagAllCommand extends Command
|
|||
try {
|
||||
$user = $this->getUser($input->getArgument('username'));
|
||||
} catch (NoResultException $e) {
|
||||
$io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
|
||||
$io->error(\sprintf('User "%s" not found.', $input->getArgument('username')));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
$io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));
|
||||
$io->text(\sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));
|
||||
|
||||
$entries = $this->ruleBasedTagger->tagAllForUser($user);
|
||||
|
||||
|
|
|
@ -1088,7 +1088,7 @@ class EntryRestController extends WallabagRestController
|
|||
{
|
||||
$expect = $request->query->get('expect', 'entry');
|
||||
if (!\in_array($expect, ['id', 'entry'], true)) {
|
||||
throw new BadRequestHttpException(sprintf("expect: 'id' or 'entry' expected, %s given", $expect));
|
||||
throw new BadRequestHttpException(\sprintf("expect: 'id' or 'entry' expected, %s given", $expect));
|
||||
}
|
||||
$this->validateAuthentication();
|
||||
$this->validateUserAccess($entry->getUser()->getId());
|
||||
|
|
|
@ -657,7 +657,7 @@ class EntryController extends AbstractController
|
|||
$qb = $this->entryRepository->getBuilderForAllByUser($this->getUser()->getId());
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
|
||||
throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
|
||||
}
|
||||
|
||||
$form = $this->createForm(EntryFilterType::class, [], $formOptions);
|
||||
|
|
|
@ -102,7 +102,7 @@ class FeedController extends AbstractController
|
|||
];
|
||||
|
||||
if (!isset($sorts[$sort])) {
|
||||
throw new BadRequestHttpException(sprintf('Sort "%s" is not available.', $sort));
|
||||
throw new BadRequestHttpException(\sprintf('Sort "%s" is not available.', $sort));
|
||||
}
|
||||
|
||||
$url = $this->generateUrl(
|
||||
|
@ -200,7 +200,7 @@ class FeedController extends AbstractController
|
|||
$qb = $this->entryRepository->getBuilderForAllByUser($user->getId());
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
|
||||
throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
|
||||
}
|
||||
|
||||
$pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
|
||||
|
|
|
@ -114,7 +114,7 @@ class EntryFilterType extends AbstractType
|
|||
return false;
|
||||
}
|
||||
|
||||
$paramName = sprintf('%s', str_replace('.', '_', $field));
|
||||
$paramName = \sprintf('%s', str_replace('.', '_', $field));
|
||||
$expression = $filterQuery->getExpr()->eq($field, ':' . $paramName);
|
||||
$parameters = [$paramName => $value];
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class EntriesExport
|
|||
return $this->$functionName();
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('The format "%s" is not yet supported.', $format));
|
||||
throw new \InvalidArgumentException(\sprintf('The format "%s" is not yet supported.', $format));
|
||||
}
|
||||
|
||||
public function exportJsonData()
|
||||
|
@ -196,7 +196,7 @@ class EntriesExport
|
|||
foreach ($entry->getTags() as $tag) {
|
||||
$book->setSubject($tag->getLabel());
|
||||
}
|
||||
$filename = sha1(sprintf('%s:%s', $entry->getUrl(), $entry->getTitle()));
|
||||
$filename = sha1(\sprintf('%s:%s', $entry->getUrl(), $entry->getTitle()));
|
||||
|
||||
$publishedBy = $entry->getPublishedBy();
|
||||
$authors = $this->translator->trans('export.unknown');
|
||||
|
@ -232,8 +232,8 @@ class EntriesExport
|
|||
$book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd);
|
||||
|
||||
// Could also be the ISBN number, prefered for published books, or a UUID.
|
||||
$hash = sha1(sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds)));
|
||||
$book->setIdentifier(sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI);
|
||||
$hash = sha1(\sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds)));
|
||||
$book->setIdentifier(\sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI);
|
||||
|
||||
return Response::create(
|
||||
$book->getBook(),
|
||||
|
|
|
@ -60,7 +60,7 @@ class PocketImport extends AbstractImport
|
|||
|
||||
return $response->toArray()['code'];
|
||||
} catch (ExceptionInterface $e) {
|
||||
$this->logger->error(sprintf('PocketImport: Failed to request token: %s', $e->getMessage()), ['exception' => $e]);
|
||||
$this->logger->error(\sprintf('PocketImport: Failed to request token: %s', $e->getMessage()), ['exception' => $e]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class PocketImport extends AbstractImport
|
|||
|
||||
return true;
|
||||
} catch (ExceptionInterface $e) {
|
||||
$this->logger->error(sprintf('PocketImport: Failed to authorize client: %s', $e->getMessage()), ['exception' => $e]);
|
||||
$this->logger->error(\sprintf('PocketImport: Failed to authorize client: %s', $e->getMessage()), ['exception' => $e]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class PocketImport extends AbstractImport
|
|||
|
||||
return true;
|
||||
} catch (ExceptionInterface $e) {
|
||||
$this->logger->error(sprintf('PocketImport: Failed to import: %s', $e->getMessage()), ['exception' => $e]);
|
||||
$this->logger->error(\sprintf('PocketImport: Failed to import: %s', $e->getMessage()), ['exception' => $e]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ class Matches
|
|||
public function __invoke($subject, $pattern)
|
||||
{
|
||||
if ("'" === $pattern[0]) {
|
||||
$pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
|
||||
$pattern = \sprintf("'%%%s%%'", substr($pattern, 1, -1));
|
||||
}
|
||||
|
||||
return sprintf('UPPER(%s) LIKE UPPER(%s)', $subject, $pattern);
|
||||
return \sprintf('UPPER(%s) LIKE UPPER(%s)', $subject, $pattern);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ class NotMatches
|
|||
public function __invoke($subject, $pattern)
|
||||
{
|
||||
if ("'" === $pattern[0]) {
|
||||
$pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
|
||||
$pattern = \sprintf("'%%%s%%'", substr($pattern, 1, -1));
|
||||
}
|
||||
|
||||
return sprintf('UPPER(%s) NOT LIKE UPPER(%s)', $subject, $pattern);
|
||||
return \sprintf('UPPER(%s) NOT LIKE UPPER(%s)', $subject, $pattern);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface
|
|||
$user = $userRepository->findOneByUsernameAndFeedtoken($username, $feedToken);
|
||||
|
||||
if (null === $user || !($user instanceof User)) {
|
||||
throw new NotFoundHttpException(sprintf('%s not found.', $configuration->getClass()));
|
||||
throw new NotFoundHttpException(\sprintf('%s not found.', $configuration->getClass()));
|
||||
}
|
||||
|
||||
// Map found user to the route's parameter
|
||||
|
|
|
@ -306,7 +306,7 @@ class EntryRepository extends ServiceEntityRepository
|
|||
$fields = array_filter($fieldNames, function ($k) {
|
||||
return 'content' !== $k;
|
||||
});
|
||||
$qb->select(sprintf('partial e.{%s}', implode(',', $fields)));
|
||||
$qb->select(\sprintf('partial e.{%s}', implode(',', $fields)));
|
||||
}
|
||||
|
||||
if (null !== $isArchived) {
|
||||
|
@ -780,6 +780,6 @@ class EntryRepository extends ServiceEntityRepository
|
|||
*/
|
||||
private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc')
|
||||
{
|
||||
return $qb->orderBy(sprintf('e.%s', $sortBy), $direction);
|
||||
return $qb->orderBy(\sprintf('e.%s', $sortBy), $direction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
|
|||
$qb = $this->entryRepository->getCountBuilderForAllByUser($user->getId());
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
|
||||
throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
|
||||
}
|
||||
|
||||
$query = $qb
|
||||
|
|
|
@ -1709,7 +1709,7 @@ class EntryControllerTest extends WallabagTestCase
|
|||
// the deletion link of the first tag
|
||||
$link = $crawler->filter('body div#article div.tools ul.tags li.chip a')->extract(['href'])[1];
|
||||
|
||||
$this->assertStringStartsWith(sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
|
||||
$this->assertStringStartsWith(\sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
|
||||
}
|
||||
|
||||
public function testRandom()
|
||||
|
|
Loading…
Reference in a new issue