More lint

old-stable24
Varun Patil 2022-10-19 10:15:14 -07:00
parent a58d54883c
commit fcd8c4c388
9 changed files with 34 additions and 38 deletions

View File

@ -72,8 +72,7 @@ class Index extends Command
IManager $encryptionManager,
IDBConnection $connection,
ContainerInterface $container
)
{
) {
parent::__construct();
$this->userManager = $userManager;

View File

@ -63,8 +63,7 @@ class ApiController extends Controller
IRootFolder $rootFolder,
IAppManager $appManager,
IPreview $previewManager
)
{
) {
parent::__construct(Application::APPNAME, $request);
$this->config = $config;
@ -369,10 +368,10 @@ class ApiController extends Controller
$image->readImageBlob($preview->getContent());
$iw = $image->getImageWidth();
$ih = $image->getImageHeight();
$dw = (float) ($detection['width']);
$dh = (float) ($detection['height']);
$dcx = (float) ($detection['x']) + (float) ($detection['width']) / 2;
$dcy = (float) ($detection['y']) + (float) ($detection['height']) / 2;
$dw = (float) $detection['width'];
$dh = (float) $detection['height'];
$dcx = (float) $detection['x'] + (float) $detection['width'] / 2;
$dcy = (float) $detection['y'] + (float) $detection['height'] / 2;
$faceDim = max($dw * $iw, $dh * $ih) * 1.5;
$image->cropImage(
(int) $faceDim,

View File

@ -35,8 +35,7 @@ class PageController extends Controller
IInitialState $initialState,
IUserSession $userSession,
IConfig $config
)
{
) {
parent::__construct($AppName, $request);
$this->userId = $UserId;
$this->appName = $AppName;

View File

@ -41,8 +41,8 @@ class TimelineQuery
}
return [
'fileid' => (int) ($row['fileid']),
'dayid' => (int) ($row['dayid']),
'fileid' => (int) $row['fileid'],
'dayid' => (int) $row['dayid'],
'datetaken' => $utcTs,
];
}

View File

@ -120,8 +120,8 @@ trait TimelineQueryDays
private function processDays(&$days)
{
foreach ($days as &$row) {
$row['dayid'] = (int) ($row['dayid']);
$row['count'] = (int) ($row['count']);
$row['dayid'] = (int) $row['dayid'];
$row['count'] = (int) $row['count'];
// All transform processing
$this->processFace($row, true);
@ -142,11 +142,11 @@ trait TimelineQueryDays
unset($row['datetaken']);
// Convert field types
$row['fileid'] = (int) ($row['fileid']);
$row['isvideo'] = (int) ($row['isvideo']);
$row['dayid'] = (int) ($row['dayid']);
$row['w'] = (int) ($row['w']);
$row['h'] = (int) ($row['h']);
$row['fileid'] = (int) $row['fileid'];
$row['isvideo'] = (int) $row['isvideo'];
$row['dayid'] = (int) $row['dayid'];
$row['w'] = (int) $row['w'];
$row['h'] = (int) $row['h'];
if (!$row['isvideo']) {
unset($row['isvideo']);
}

View File

@ -77,10 +77,10 @@ trait TimelineQueryFaces
// Post process
foreach ($faces as &$row) {
$row['id'] = (int) ($row['id']);
$row['id'] = (int) $row['id'];
$row['name'] = $row['title'];
unset($row['title']);
$row['count'] = (int) ($row['count']);
$row['count'] = (int) $row['count'];
}
return $faces;
@ -128,12 +128,12 @@ trait TimelineQueryFaces
// Get actual pixel size of face
$iw = min((int) ($p['image_width'] ?: 512), 2048);
$ih = min((int) ($p['image_height'] ?: 512), 2048);
$w = (float) ($p['width']) * $iw;
$h = (float) ($p['height']) * $ih;
$w = (float) $p['width'] * $iw;
$h = (float) $p['height'] * $ih;
// Get center of face
$x = (float) ($p['x']) + (float) ($p['width']) / 2;
$y = (float) ($p['y']) + (float) ($p['height']) / 2;
$x = (float) $p['x'] + (float) $p['width'] / 2;
$y = (float) $p['y'] + (float) $p['height'] / 2;
// 3D normal distribution - if the face is closer to the center, it's better
$positionScore = exp(-($x - 0.5) ** 2 * 4) * exp(-($y - 0.5) ** 2 * 4);
@ -163,10 +163,10 @@ trait TimelineQueryFaces
if (!$days) {
$row['facerect'] = [
'w' => (float) ($row['face_w']),
'h' => (float) ($row['face_h']),
'x' => (float) ($row['face_x']),
'y' => (float) ($row['face_y']),
'w' => (float) $row['face_w'],
'h' => (float) $row['face_h'],
'x' => (float) $row['face_x'],
'y' => (float) $row['face_y'],
];
}

View File

@ -70,8 +70,8 @@ trait TimelineQueryTags
// Post process
foreach ($tags as &$row) {
$row['id'] = (int) ($row['id']);
$row['count'] = (int) ($row['count']);
$row['id'] = (int) $row['id'];
$row['count'] = (int) $row['count'];
}
return $tags;
@ -89,8 +89,8 @@ trait TimelineQueryTags
'systemtag_object_mapping',
'stom'
)->where(
$query->expr()->eq('stom.objecttype', $query->createNamedParameter('files')),
);
$query->expr()->eq('stom.objecttype', $query->createNamedParameter('files')),
);
// WHERE these items are memories indexed photos
$query->innerJoin('stom', 'memories', 'm', $query->expr()->eq('m.fileid', 'stom.objectid'));
@ -113,8 +113,8 @@ trait TimelineQueryTags
// Post-process
foreach ($previews as &$row) {
$row['fileid'] = (int) ($row['fileid']);
$row['systemtagid'] = (int) ($row['systemtagid']);
$row['fileid'] = (int) $row['fileid'];
$row['systemtagid'] = (int) $row['systemtagid'];
unset($row['n']);
}

View File

@ -71,7 +71,7 @@ class TimelineWrite
$cursor = $query->executeQuery();
$prevRow = $cursor->fetch();
$cursor->closeCursor();
if ($prevRow && !$force && (int) ($prevRow['mtime']) === $mtime) {
if ($prevRow && !$force && (int) $prevRow['mtime'] === $mtime) {
return 1;
}

View File

@ -37,8 +37,7 @@ class PostWriteListener implements IEventListener
public function __construct(
IDBConnection $connection,
IUserManager $userManager
)
{
) {
$this->userManager = $userManager;
$this->timelineWrite = new TimelineWrite($connection);
}