More lint

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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