Skip to content

Commit

Permalink
style: Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <[email protected]>
  • Loading branch information
juliusknorr committed Oct 18, 2024
1 parent 524971d commit 24f182f
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 54 deletions.
18 changes: 9 additions & 9 deletions lib/Command/Lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Lock extends Base {
*/
public function __construct(
IUserManager $userManager, LocksRequest $locksRequest, FileService $fileService,
LockService $lockService, ConfigService $configService
LockService $lockService, ConfigService $configService,
) {
parent::__construct();

Expand All @@ -80,14 +80,14 @@ public function __construct(
protected function configure() {
parent::configure();
$this->setName('files:lock')
->addOption('unlock', 'u', InputOption::VALUE_NONE, 'unlock a file')
->addOption(
'uninstall', '', InputOption::VALUE_NONE, 'fully uninstall the app from your Nextcloud'
)
->addOption('status', 's', InputOption::VALUE_NONE, 'returns lock status of the file')
->addArgument('file_id', InputArgument::OPTIONAL, 'Id of the locked file', 0)
->addArgument('user_id', InputArgument::OPTIONAL, 'owner of the lock', '')
->setDescription('lock a file to a user');
->addOption('unlock', 'u', InputOption::VALUE_NONE, 'unlock a file')
->addOption(
'uninstall', '', InputOption::VALUE_NONE, 'fully uninstall the app from your Nextcloud'
)
->addOption('status', 's', InputOption::VALUE_NONE, 'returns lock status of the file')
->addArgument('file_id', InputArgument::OPTIONAL, 'Id of the locked file', 0)
->addArgument('user_id', InputArgument::OPTIONAL, 'owner of the lock', '')
->setDescription('lock a file to a user');
}


Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/LockController.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected function fail(
Exception $e,
array $more = [],
int $status = Http::STATUS_INTERNAL_SERVER_ERROR,
bool $log = true
bool $log = true,
): DataResponse {
$data = array_merge(
$more,
Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/LockBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LockBackend implements BackendInterface {
public function __construct(
private FileService $fileService,
private LockService $lockService,
private bool $absolute
private bool $absolute,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/LockPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function cacheDirectory(Directory $directory): void {
$ids[] = (string)$id;
}

$ids[] = (string) $directory->getId();
$ids[] = (string)$directory->getId();
// the lock service will take care of the caching
$this->lockService->getLockForNodeIds($ids);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Db/LocksRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class LocksRequest extends LocksRequestBuilder {
public function save(FileLock $lock) {
$qb = $this->getLocksInsertSql();
$qb->setValue('user_id', $qb->createNamedParameter($lock->getOwner()))
->setValue('file_id', $qb->createNamedParameter($lock->getFileId()))
->setValue('token', $qb->createNamedParameter($lock->getToken()))
->setValue('creation', $qb->createNamedParameter($lock->getCreatedAt()))
->setValue('type', $qb->createNamedParameter($lock->getType()))
->setValue('ttl', $qb->createNamedParameter($lock->getTimeout()));
->setValue('file_id', $qb->createNamedParameter($lock->getFileId()))
->setValue('token', $qb->createNamedParameter($lock->getToken()))
->setValue('creation', $qb->createNamedParameter($lock->getCreatedAt()))
->setValue('type', $qb->createNamedParameter($lock->getType()))
->setValue('ttl', $qb->createNamedParameter($lock->getTimeout()));

try {
$qb->execute();
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/LocksRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function getLocksSelectSql(): CoreQueryBuilder {
$qb = $this->getQueryBuilder();

$qb->select('l.id', 'l.user_id', 'l.file_id', 'l.token', 'l.creation', 'l.type', 'l.ttl', 'l.owner')
->from(self::TABLE_LOCKS, 'l');
->from(self::TABLE_LOCKS, 'l');

$qb->setDefaultSelectAlias('l');

Expand Down
8 changes: 4 additions & 4 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(IUserSession $userSession, IRootFolder $rootFolder)
*/
public function getFileFromId(string $userId, int $fileId): Node {
$files = $this->rootFolder->getUserFolder($userId)
->getById($fileId);
->getById($fileId);

if (sizeof($files) === 0) {
throw new NotFoundException();
Expand All @@ -71,7 +71,7 @@ public function getFileFromPath(string $userId, string $path): Node {

$path = '/' . substr($path, 6);
$file = $this->rootFolder->getUserFolder($userId)
->get($path);
->get($path);

return $file;
}
Expand All @@ -93,7 +93,7 @@ public function getFileFromUri(string $uri): Node {

$path = '/' . $uri;
$file = $this->rootFolder->getUserFolder($userId)
->get($path);
->get($path);

return $file;
}
Expand All @@ -114,7 +114,7 @@ public function getFileFromAbsoluteUri(string $uri): Node {
}
$path = '/' . $path;
$file = $this->rootFolder->getUserFolder($userId)
->get($path);
->get($path);

return $file;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Storage/LockWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function isLocked(string $ownerId, string $path, string $viewerId, &$l
return true;
}
}
} catch (NoLockProviderException | LockNotFoundException | InvalidPathException | NotFoundException $e) {
} catch (NoLockProviderException|LockNotFoundException|InvalidPathException|NotFoundException $e) {
}

return false;
Expand Down
24 changes: 12 additions & 12 deletions lib/Tools/Db/ExtendedQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function searchInDBField(string $field, string $value): void {
* @deprecated - should be removed
*/
public function exprFieldWithinJsonFormat(
IQueryBuilder $qb, string $field, string $fieldRight, string $alias = ''
IQueryBuilder $qb, string $field, string $fieldRight, string $alias = '',
): string {
$func = $qb->func();
$expr = $qb->expr();
Expand Down Expand Up @@ -212,7 +212,7 @@ public function exprFieldWithinJsonFormat(
* @deprecated - should be removed
*/
public function exprValueWithinJsonFormat(
IQueryBuilder $qb, string $field, string $value, bool $eq = true, bool $cs = true
IQueryBuilder $qb, string $field, string $value, bool $eq = true, bool $cs = true,
): string {
$dbConn = $this->getConnection();
$expr = $qb->expr();
Expand Down Expand Up @@ -434,7 +434,7 @@ public function exprLimitBool(string $field, bool $value, string $alias = ''): s
public function exprLimitEmpty(
string $field,
bool $orNull = false,
string $alias = ''
string $alias = '',
): ICompositeExpression {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
Expand All @@ -460,7 +460,7 @@ public function exprLimitEmpty(
public function exprLimitNull(
string $field,
bool $orEmpty = false,
string $alias = ''
string $alias = '',
): ICompositeExpression {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
Expand Down Expand Up @@ -489,7 +489,7 @@ public function exprLimitArray(
string $field,
array $values,
string $alias = '',
bool $cs = true
bool $cs = true,
): ICompositeExpression {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
Expand Down Expand Up @@ -785,7 +785,7 @@ public function exprFilterBool(string $field, bool $value, string $alias = ''):
public function exprFilterEmpty(
string $field,
bool $norNull = false,
string $alias = ''
string $alias = '',
): ICompositeExpression {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
Expand All @@ -811,7 +811,7 @@ public function exprFilterEmpty(
public function exprFilterNull(
string $field,
bool $norEmpty = false,
string $alias = ''
string $alias = '',
): ICompositeExpression {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
Expand Down Expand Up @@ -840,7 +840,7 @@ public function exprFilterArray(
string $field,
array $values,
string $alias = '',
bool $cs = true
bool $cs = true,
): ICompositeExpression {
if ($this->getType() === DBALQueryBuilder::SELECT) {
$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
Expand Down Expand Up @@ -933,7 +933,7 @@ private function parseSimpleSelectSql(
array $data,
ExtendedQueryBuilder $qb,
string $object,
array $params
array $params,
): IQueryRow {
$fromField = $this->get('modelFromField', $params);
if ($fromField !== '') {
Expand Down Expand Up @@ -1010,7 +1010,7 @@ public function generateSelect(
string $table,
array $fields,
string $alias = '',
bool $distinct = false
bool $distinct = false,
): self {
$selectFields = array_map(
function (string $item) use ($alias) {
Expand All @@ -1029,7 +1029,7 @@ function (string $item) use ($alias) {
}

$this->from($table, $alias)
->setDefaultSelectAlias($alias);
->setDefaultSelectAlias($alias);

return $this;
}
Expand All @@ -1047,7 +1047,7 @@ public function generateSelectAlias(
array $fields,
string $alias,
string $prefix,
array $default = []
array $default = [],
): self {
$prefix = trim($prefix) . '_';
$grouping = true;
Expand Down
34 changes: 17 additions & 17 deletions lib/Tools/Traits/TLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public function throwable(Throwable $t, int $level = 3, array $serializable = []
}

$this->logger()
->log(
$level,
$message,
[
'app' => $this->setup('app'),
'exception' => $t
]
);
->log(
$level,
$message,
[
'app' => $this->setup('app'),
'exception' => $t
]
);
}


Expand Down Expand Up @@ -91,14 +91,14 @@ public function exception(Exception $e, $level = 3, array $serializable = []): v
}

$this->logger()
->log(
$level,
$message,
[
'app' => $this->setup('app'),
'exception' => $e
]
);
->log(
$level,
$message,
[
'app' => $this->setup('app'),
'exception' => $e
]
);
}


Expand Down Expand Up @@ -164,7 +164,7 @@ public function log(int $level, string $message, bool $trace = false, array $ser
}

$this->logger()
->log($level, $message, $opts);
->log($level, $message, $opts);
}


Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/LockFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
* @group DB
*/
class LockFeatureTest extends TestCase {
public const TEST_USER1 = "test-user1";
public const TEST_USER2 = "test-user2";
public const TEST_USER1 = 'test-user1';
public const TEST_USER2 = 'test-user2';

protected LockManager $lockManager;
protected IRootFolder $rootFolder;
Expand Down

0 comments on commit 24f182f

Please sign in to comment.