@@ -74,6 +74,6 @@ |
||
| 74 | 74 | throw new \Exception('No meta data found', 1475144024); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - return (int) $metaData['uid']; |
|
| 77 | + return (int)$metaData['uid']; |
|
| 78 | 78 | } |
| 79 | 79 | } |
@@ -26,12 +26,12 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public static function getFileByMetaData($uid) |
| 28 | 28 | { |
| 29 | - $row = GeneralUtility::makeInstance(SysFileMetadataRepository::class)->findByUid((int) $uid); |
|
| 29 | + $row = GeneralUtility::makeInstance(SysFileMetadataRepository::class)->findByUid((int)$uid); |
|
| 30 | 30 | if (!isset($row['file'])) { |
| 31 | 31 | throw new \Exception('File not found in metadata', 1475144028); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - return self::getFileByUid((int) $row['file']); |
|
| 34 | + return self::getFileByUid((int)$row['file']); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -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 | } |
@@ -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 | } |
@@ -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)->update((int) $this->getMataDataUid(), $values); |
|
| 69 | + GeneralUtility::makeInstance(SysFileMetadataRepository::class)->update((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)->update((int) $this->getReferenceUid(), $values); |
|
| 81 | + GeneralUtility::makeInstance(SysFileReferenceRepository::class)->update((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->findOneByFileUid((int) $fileUid); |
|
| 88 | + $row = $sysFileMatadataRepository->findOneByFileUid((int)$fileUid); |
|
| 89 | 89 | if ($row) { |
| 90 | - $sysFileMatadataRepository->update((int) $row['uid'], $values); |
|
| 90 | + $sysFileMatadataRepository->update((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 | } |
@@ -146,14 +146,14 @@ |
||
| 146 | 146 | } |
| 147 | 147 | $docRoot = \rtrim(GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '/') . '/'; |
| 148 | 148 | $relativeSrc = \str_replace($docRoot, '', $absoluteImageName); |
| 149 | - $focusPointX = MathUtility::forceIntegerInRange((int) $x, -100, 100, 0); |
|
| 150 | - $focusPointY = MathUtility::forceIntegerInRange((int) $y, -100, 100, 0); |
|
| 149 | + $focusPointX = MathUtility::forceIntegerInRange((int)$x, -100, 100, 0); |
|
| 150 | + $focusPointY = MathUtility::forceIntegerInRange((int)$y, -100, 100, 0); |
|
| 151 | 151 | |
| 152 | 152 | if (0 === $focusPointX && 0 === $focusPointY) { |
| 153 | 153 | $row = GeneralUtility::makeInstance(FileStandaloneRepository::class)->findOneByRelativeFilePath($relativeSrc); |
| 154 | 154 | if (isset($row['focus_point_x'])) { |
| 155 | - $focusPointX = MathUtility::forceIntegerInRange((int) $row['focus_point_x'], -100, 100, 0); |
|
| 156 | - $focusPointY = MathUtility::forceIntegerInRange((int) $row['focus_point_y'], -100, 100, 0); |
|
| 155 | + $focusPointX = MathUtility::forceIntegerInRange((int)$row['focus_point_x'], -100, 100, 0); |
|
| 156 | + $focusPointY = MathUtility::forceIntegerInRange((int)$row['focus_point_y'], -100, 100, 0); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
@@ -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) { |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | $row = GeneralUtility::makeInstance(DimensionRepository::class)->findOneByIdentifier($ratio); |
| 247 | 247 | if (isset($row['dimension'])) { |
| 248 | - return (string) $row['dimension']; |
|
| 248 | + return (string)$row['dimension']; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | return $ratio; |