style: apply php-lint

pull/376/head
Raymond Huang 2023-01-26 08:48:17 +08:00
parent 80a433a874
commit ea8d08eba7
3 changed files with 30 additions and 35 deletions

View File

@ -248,10 +248,6 @@ class LocationsController extends ApiBase
* @param array $days the days array
* @param string $uid User ID or blank for public shares
* @param TimelineRoot $root the root folder
* @param string $minLat
* @param string $maxLat
* @param string $minLng
* @param string $maxLng
*/
private function preloadDaysWithBounds(array &$days, string $uid, TimelineRoot &$root, string $minLat, string $maxLat, string $minLng, string $maxLng)
{
@ -266,7 +262,7 @@ class LocationsController extends ApiBase
$preloaded += $day['count'];
$preloadDayIds[] = $day['dayid'];
$preloadDays[] = & $day;
$preloadDays[] = &$day;
if ($preloaded >= 50 || \count($preloadDayIds) > 5) { // should be enough
break;
@ -290,7 +286,7 @@ class LocationsController extends ApiBase
// Group into dayid
$detailMap = [];
foreach ($allDetails as &$detail) {
$detailMap[$detail['dayid']][] = & $detail;
$detailMap[$detail['dayid']][] = &$detail;
}
foreach ($preloadDays as &$day) {
$m = $detailMap[$day['dayid']];

View File

@ -34,8 +34,7 @@ class PageController extends Controller
IInitialState $initialState,
IUserSession $userSession,
IConfig $config
)
{
) {
parent::__construct($AppName, $request);
$this->userId = $UserId;
$this->appName = $AppName;
@ -64,21 +63,27 @@ class PageController extends Controller
// Configuration
$uid = $user->getUID();
$this->initialState->provideInitialState('timelinePath', $this->config->getUserValue(
$this->initialState->provideInitialState(
'timelinePath',
$this->config->getUserValue(
$uid,
Application::APPNAME,
'timelinePath',
'EMPTY'
)
);
$this->initialState->provideInitialState('foldersPath', $this->config->getUserValue(
$this->initialState->provideInitialState(
'foldersPath',
$this->config->getUserValue(
$uid,
Application::APPNAME,
'foldersPath',
'/'
)
);
$this->initialState->provideInitialState('showHidden', $this->config->getUserValue(
$this->initialState->provideInitialState(
'showHidden',
$this->config->getUserValue(
$uid,
Application::APPNAME,
'showHidden',

View File

@ -99,8 +99,7 @@ trait TimelineQueryDays
bool $recursive,
bool $archive,
array $queryTransforms = []
): array
{
): array {
$query = $this->connection->getQueryBuilder();
// Get all entries also present in filecache
@ -144,13 +143,12 @@ trait TimelineQueryDays
string $uid,
bool $recursive,
bool $archive,
array $queryTransforms = [],
array $queryTransforms,
string $minLat,
string $maxLat,
string $minLng,
string $maxLng
): array
{
): array {
$query = $this->connection->getQueryBuilder();
// Get all entries also present in filecache
@ -203,8 +201,7 @@ trait TimelineQueryDays
bool $recursive,
bool $archive,
array $queryTransforms = []
): array
{
): array {
$query = $this->connection->getQueryBuilder();
// Get all entries also present in filecache
@ -272,20 +269,18 @@ trait TimelineQueryDays
*
* @return array An array of day responses
*/
public function getDayWithBounds(
TimelineRoot &$root,
string $uid,
?array $day_ids,
bool $recursive,
bool $archive,
array $queryTransforms = [],
array $queryTransforms,
string $minLat,
string $maxLat,
string $minLng,
string $maxLng
): array
{
): array {
$query = $this->connection->getQueryBuilder();
// Get all entries also present in filecache
@ -408,7 +403,7 @@ trait TimelineQueryDays
$actualPath[1] = $actualPath[2];
$actualPath[2] = $tmp;
$davPath = implode('/', $actualPath);
$davPaths[$fileid] = Exif::removeExtraSlash('/' . $davPath . '/');
$davPaths[$fileid] = Exif::removeExtraSlash('/'.$davPath.'/');
}
}
}
@ -441,7 +436,7 @@ trait TimelineQueryDays
if (0 === strpos($row['path'], $basePath)) {
$rpath = substr($row['path'], \strlen($basePath));
$row['filename'] = Exif::removeExtraSlash($davPath . $rpath);
$row['filename'] = Exif::removeExtraSlash($davPath.$rpath);
}
unset($row['path']);
@ -471,7 +466,7 @@ trait TimelineQueryDays
// Add WITH clause if needed
if (false !== strpos($sql, 'cte_folders')) {
$sql = $CTE_SQL . ' ' . $sql;
$sql = $CTE_SQL.' '.$sql;
}
return $this->connection->executeQuery($sql, $params, $types);
@ -484,8 +479,7 @@ trait TimelineQueryDays
IQueryBuilder &$query,
TimelineRoot &$root,
bool $archive
)
{
) {
// Add query parameters
$query->setParameter('topFolderIds', $root->getIds(), IQueryBuilder::PARAM_INT_ARRAY);
$query->setParameter('cteFoldersArchive', $archive, IQueryBuilder::PARAM_BOOL);
@ -504,8 +498,7 @@ trait TimelineQueryDays
TimelineRoot &$root,
bool $recursive,
bool $archive
)
{
) {
// Join with memories
$baseOp = $query->expr()->eq('f.fileid', 'm.fileid');
if ($root->isEmpty()) {
@ -526,7 +519,8 @@ trait TimelineQueryDays
return $query->innerJoin(
'm',
'filecache',
'f', $query->expr()->andX(
'f',
$query->expr()->andX(
$baseOp,
$pathOp,
)