@@ -59,7 +59,7 @@ |
||
59 | 59 | $table = 'tx_focuspoint_domain_model_dimension'; |
60 | 60 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table); |
61 | 61 | |
62 | - return (array) $queryBuilder->select('*') |
|
62 | + return (array)$queryBuilder->select('*') |
|
63 | 63 | ->from($table) |
64 | 64 | ->execute() |
65 | 65 | ->fetchAll(); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function getFocusWidthAndHeight(int $width, int $height, string $ratio): array |
64 | 64 | { |
65 | - $width = (int) $width; |
|
66 | - $height = (int) $height; |
|
65 | + $width = (int)$width; |
|
66 | + $height = (int)$height; |
|
67 | 67 | $ratio = $this->getRatio($ratio); |
68 | 68 | $widthDiff = $width / $ratio[0]; |
69 | 69 | $heightDiff = $height / $ratio[1]; |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | if ($widthDiff < $heightDiff) { |
72 | 72 | return [ |
73 | 73 | $width, |
74 | - (int) \ceil($widthDiff / $heightDiff * $height), |
|
74 | + (int)\ceil($widthDiff / $heightDiff * $height), |
|
75 | 75 | ]; |
76 | 76 | } |
77 | 77 | if ($widthDiff > $heightDiff) { |
78 | 78 | return [ |
79 | - (int) \ceil($heightDiff / $widthDiff * $width), |
|
79 | + (int)\ceil($heightDiff / $widthDiff * $width), |
|
80 | 80 | $height, |
81 | 81 | ]; |
82 | 82 | } |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | |
163 | 163 | $newFocusX = ($newRealFocusX - $newHalfWidth) * 100 / ($newHalfWidth); |
164 | 164 | $newFocusY = ($newHalfHeight - $newRealFocusY) * 100 / ($newHalfHeight); |
165 | - $newFocusX = (int) \round($newFocusX, 0); |
|
166 | - $newFocusY = (int) \round($newFocusY, 0); |
|
165 | + $newFocusX = (int)\round($newFocusX, 0); |
|
166 | + $newFocusY = (int)\round($newFocusY, 0); |
|
167 | 167 | |
168 | 168 | return [$newFocusX, $newFocusY]; |
169 | 169 | } |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | return [ |
189 | - MathUtility::canBeInterpretedAsInteger($ratio[0]) ? (int) $ratio[0] : (float) \str_replace( |
|
189 | + MathUtility::canBeInterpretedAsInteger($ratio[0]) ? (int)$ratio[0] : (float)\str_replace( |
|
190 | 190 | ',', |
191 | 191 | '.', |
192 | 192 | $ratio[0] |
193 | 193 | ), |
194 | - MathUtility::canBeInterpretedAsInteger($ratio[1]) ? (int) $ratio[1] : (float) \str_replace( |
|
194 | + MathUtility::canBeInterpretedAsInteger($ratio[1]) ? (int)$ratio[1] : (float)\str_replace( |
|
195 | 195 | ',', |
196 | 196 | '.', |
197 | 197 | $ratio[1] |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | protected function getShiftedFocusAreaPosition(int $length, int $focusLength, int $focusPosition, bool $invertScala = false): array |
213 | 213 | { |
214 | 214 | $halfWidth = $length / 2; |
215 | - $pixelPosition = (int) \floor($halfWidth * $focusPosition / 100 + $halfWidth); |
|
215 | + $pixelPosition = (int)\floor($halfWidth * $focusPosition / 100 + $halfWidth); |
|
216 | 216 | if ($invertScala) { |
217 | 217 | $pixelPosition = $length - $pixelPosition; |
218 | 218 | } |
219 | - $crop1 = (int) ($pixelPosition - \floor($focusLength / 2)); |
|
220 | - $crop2 = (int) ($crop1 + $focusLength); |
|
219 | + $crop1 = (int)($pixelPosition - \floor($focusLength / 2)); |
|
220 | + $crop2 = (int)($crop1 + $focusLength); |
|
221 | 221 | if ($crop1 < 0) { |
222 | 222 | $crop1 -= $crop1; |
223 | 223 | } elseif ($crop2 > $length) { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | ->execute()->fetchAll(); |
254 | 254 | |
255 | 255 | if (!empty($rows)) { |
256 | - return (string) $rows[0]['dimension']; |
|
256 | + return (string)$rows[0]['dimension']; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | return $ratio; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getCurrentPoint() |
47 | 47 | { |
48 | - $row = GeneralUtility::makeInstance(SysFileMetadataRepository::class)->findByUid((int) $this->getMataDataUid()); |
|
48 | + $row = GeneralUtility::makeInstance(SysFileMetadataRepository::class)->findByUid((int)$this->getMataDataUid()); |
|
49 | 49 | |
50 | 50 | return $this->cleanupPosition([ |
51 | 51 | $row['focus_point_x'], |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'focus_point_y' => MathUtility::forceIntegerInRange($y, -100, 100, 0), |
67 | 67 | ]; |
68 | 68 | |
69 | - GeneralUtility::makeInstance(SysFileMetadataRepository::class)->updateByUid((int) $this->getMataDataUid(), $values); |
|
69 | + GeneralUtility::makeInstance(SysFileMetadataRepository::class)->updateByUid((int)$this->getMataDataUid(), $values); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | } |
95 | 95 | $p = $parameter['P']; |
96 | 96 | if (isset($p['metaUid']) && MathUtility::canBeInterpretedAsInteger($p['metaUid'])) { |
97 | - return (int) $p['metaUid']; |
|
97 | + return (int)$p['metaUid']; |
|
98 | 98 | } |
99 | 99 | if (isset($p['table']) && 'sys_file_metadata' === $p['table'] && isset($p['uid']) && MathUtility::canBeInterpretedAsInteger($p['uid'])) { |
100 | - return (int) $p['uid']; |
|
100 | + return (int)$p['uid']; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | 'focus_point_y' => MathUtility::forceIntegerInRange($y, -100, 100, 0), |
79 | 79 | ]; |
80 | 80 | |
81 | - GeneralUtility::makeInstance(SysFileReferenceRepository::class)->updateByUid((int) $this->getReferenceUid(), $values); |
|
81 | + GeneralUtility::makeInstance(SysFileReferenceRepository::class)->updateByUid((int)$this->getReferenceUid(), $values); |
|
82 | 82 | |
83 | 83 | // save also to the file |
84 | 84 | $reference = ResourceFactory::getInstance()->getFileReferenceObject($this->getReferenceUid()); |
85 | 85 | $fileUid = $reference->getOriginalFile()->getUid(); |
86 | 86 | |
87 | 87 | $sysFileMatadataRepository = GeneralUtility::makeInstance(SysFileMetadataRepository::class); |
88 | - $row = $sysFileMatadataRepository->findByFileUid((int) $fileUid); |
|
88 | + $row = $sysFileMatadataRepository->findByFileUid((int)$fileUid); |
|
89 | 89 | if ($row) { |
90 | - $sysFileMatadataRepository->updateByUid((int) $row['uid'], $values); |
|
90 | + $sysFileMatadataRepository->updateByUid((int)$row['uid'], $values); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | $p = $parameter['P']; |
106 | 106 | if (isset($p['referenceUid']) && MathUtility::canBeInterpretedAsInteger($p['referenceUid'])) { |
107 | - return (int) $p['referenceUid']; |
|
107 | + return (int)$p['referenceUid']; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -84,8 +84,8 @@ |
||
84 | 84 | protected function cleanupPosition(array $position): array |
85 | 85 | { |
86 | 86 | return [ |
87 | - MathUtility::forceIntegerInRange((int) $position[0], -100, 100, 0), |
|
88 | - MathUtility::forceIntegerInRange((int) $position[1], -100, 100, 0), |
|
87 | + MathUtility::forceIntegerInRange((int)$position[0], -100, 100, 0), |
|
88 | + MathUtility::forceIntegerInRange((int)$position[1], -100, 100, 0), |
|
89 | 89 | ]; |
90 | 90 | } |
91 | 91 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function getCurrentPoint() |
34 | 34 | { |
35 | 35 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE); |
36 | - $rows = (array) $queryBuilder->select('uid', 'focus_point_x', 'focus_point_y') |
|
36 | + $rows = (array)$queryBuilder->select('uid', 'focus_point_x', 'focus_point_y') |
|
37 | 37 | ->from(self::TABLE) |
38 | 38 | ->where( |
39 | 39 | $queryBuilder->expr()->eq('relative_file_path', $queryBuilder->createNamedParameter($this->getRelativeFilePath())) |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function setCurrentPoint($x, $y) |
61 | 61 | { |
62 | 62 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE); |
63 | - $rows = (array) $queryBuilder->select('uid') |
|
63 | + $rows = (array)$queryBuilder->select('uid') |
|
64 | 64 | ->from(self::TABLE) |
65 | 65 | ->where( |
66 | 66 | $queryBuilder->expr()->eq('relative_file_path', $queryBuilder->createNamedParameter($this->getRelativeFilePath())) |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $connection->update( |
80 | 80 | self::TABLE, |
81 | 81 | $values, |
82 | - ['uid' => (int) $rows[0]['uid']] |
|
82 | + ['uid' => (int)$rows[0]['uid']] |
|
83 | 83 | ); |
84 | 84 | } else { |
85 | 85 | $connection->insert( |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | } |
148 | 148 | $docRoot = \rtrim(GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '/') . '/'; |
149 | 149 | $relativeSrc = \str_replace($docRoot, '', $absoluteImageName); |
150 | - $focusPointX = MathUtility::forceIntegerInRange((int) $x, -100, 100, 0); |
|
151 | - $focusPointY = MathUtility::forceIntegerInRange((int) $y, -100, 100, 0); |
|
150 | + $focusPointX = MathUtility::forceIntegerInRange((int)$x, -100, 100, 0); |
|
151 | + $focusPointY = MathUtility::forceIntegerInRange((int)$y, -100, 100, 0); |
|
152 | 152 | |
153 | 153 | if (0 === $focusPointX && 0 === $focusPointY) { |
154 | 154 | $table = Group::TABLE; |
155 | 155 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table); |
156 | - $rows = (array) $queryBuilder->select('uid', 'focus_point_x', 'focus_point_y') |
|
156 | + $rows = (array)$queryBuilder->select('uid', 'focus_point_x', 'focus_point_y') |
|
157 | 157 | ->from($table) |
158 | 158 | ->where( |
159 | 159 | $queryBuilder->expr()->eq('relative_file_path', $queryBuilder->createNamedParameter($relativeSrc)) |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | ->fetchAll(); |
163 | 163 | |
164 | 164 | if (!empty($rows)) { |
165 | - $focusPointX = MathUtility::forceIntegerInRange((int) $rows[0]['focus_point_x'], -100, 100, 0); |
|
166 | - $focusPointY = MathUtility::forceIntegerInRange((int) $rows[0]['focus_point_y'], -100, 100, 0); |
|
165 | + $focusPointX = MathUtility::forceIntegerInRange((int)$rows[0]['focus_point_x'], -100, 100, 0); |
|
166 | + $focusPointY = MathUtility::forceIntegerInRange((int)$rows[0]['focus_point_y'], -100, 100, 0); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 |
@@ -53,14 +53,14 @@ |
||
53 | 53 | case 'yp': |
54 | 54 | $metaData = $originalFile->_getMetaData(); |
55 | 55 | |
56 | - return (float) $metaData['focus_point_' . \mb_substr($parts[1], 0, 1)]; |
|
56 | + return (float)$metaData['focus_point_' . \mb_substr($parts[1], 0, 1)]; |
|
57 | 57 | case 'xp_positive': |
58 | 58 | case 'yp_positive': |
59 | 59 | $metaData = $originalFile->_getMetaData(); |
60 | 60 | if ('xp_positive' === $parts[1]) { |
61 | - return (int) (\abs($metaData['focus_point_' . \mb_substr($parts[1], 0, 1)] + 100) / 2); |
|
61 | + return (int)(\abs($metaData['focus_point_' . \mb_substr($parts[1], 0, 1)] + 100) / 2); |
|
62 | 62 | } |
63 | - return (int) (\abs($metaData['focus_point_' . \mb_substr($parts[1], 0, 1)] - 100) / 2); |
|
63 | + return (int)(\abs($metaData['focus_point_' . \mb_substr($parts[1], 0, 1)] - 100) / 2); |
|
64 | 64 | case 'w': |
65 | 65 | case 'h': |
66 | 66 | $fileName = GeneralUtility::getFileAbsFileName($fileObject->getPublicUrl(true)); |
@@ -115,11 +115,11 @@ |
||
115 | 115 | if ('tt_content' !== $parts[0]) { |
116 | 116 | throw new \Exception('Invalid part 0. part 0 have to be tt_content', 127383); |
117 | 117 | } |
118 | - $record = BackendUtility::getRecord($parts[0], (int) $parts[1]); |
|
118 | + $record = BackendUtility::getRecord($parts[0], (int)$parts[1]); |
|
119 | 119 | if (!isset($record['image_ratio'])) { |
120 | 120 | throw new \Exception('No image_ratio found in the current record', 324672); |
121 | 121 | } |
122 | 122 | |
123 | - return \trim((string) $record['image_ratio']); |
|
123 | + return \trim((string)$record['image_ratio']); |
|
124 | 124 | } |
125 | 125 | } |