Completed
Push — master ( b0b1c6...4fec92 )
by Fabien
54:17
created
Classes/Thumbnail/FallBackThumbnailProcessor.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -15,40 +15,40 @@
 block discarded – undo
15 15
  */
16 16
 class FallBackThumbnailProcessor extends AbstractThumbnailProcessor
17 17
 {
18
-    /**
19
-     * Render a fallback thumbnail if no type was found for the given resource.
20
-     */
21
-    public function create(): string
22
-    {
23
-        return sprintf(
24
-            '<img src="%s" hspace="2" class="" alt="" />',
25
-            Path::getRelativePath('Icons/UnknownMimeType.png')
26
-        );
27
-    }
18
+	/**
19
+	 * Render a fallback thumbnail if no type was found for the given resource.
20
+	 */
21
+	public function create(): string
22
+	{
23
+		return sprintf(
24
+			'<img src="%s" hspace="2" class="" alt="" />',
25
+			Path::getRelativePath('Icons/UnknownMimeType.png')
26
+		);
27
+	}
28 28
 
29
-    /**
30
-     * Render the URI of the thumbnail.
31
-     */
32
-    public function renderUri(): string
33
-    {
34
-        return '';
35
-    }
29
+	/**
30
+	 * Render the URI of the thumbnail.
31
+	 */
32
+	public function renderUri(): string
33
+	{
34
+		return '';
35
+	}
36 36
 
37
-    /**
38
-     * Render the tag image which is the main one for a thumbnail.
39
-     *
40
-     */
41
-    public function renderTagImage($result): string
42
-    {
43
-        return '';
44
-    }
37
+	/**
38
+	 * Render the tag image which is the main one for a thumbnail.
39
+	 *
40
+	 */
41
+	public function renderTagImage($result): string
42
+	{
43
+		return '';
44
+	}
45 45
 
46
-    /**
47
-     * Render a wrapping anchor around the thumbnail.
48
-     *
49
-     */
50
-    public function renderTagAnchor($result): string
51
-    {
52
-        return '';
53
-    }
46
+	/**
47
+	 * Render a wrapping anchor around the thumbnail.
48
+	 *
49
+	 */
50
+	public function renderTagAnchor($result): string
51
+	{
52
+		return '';
53
+	}
54 54
 }
Please login to merge, or discard this patch.
Classes/Thumbnail/ImageThumbnailProcessor.php 2 patches
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -15,165 +15,165 @@
 block discarded – undo
15 15
  */
16 16
 class ImageThumbnailProcessor extends AbstractThumbnailProcessor
17 17
 {
18
-    protected array $defaultConfigurationWrap = [
19
-        'width' => 0,
20
-        'height' => 0,
21
-    ];
22
-
23
-    /**
24
-     * Render a thumbnail of a resource of type image.
25
-     */
26
-    public function create(): string
27
-    {
28
-        $steps = $this->getRenderingSteps();
29
-
30
-        $result = '';
31
-        while ($step = array_shift($steps)) {
32
-            $result = $this->$step($result);
33
-        }
34
-
35
-        return $result;
36
-    }
37
-
38
-    /**
39
-     * Render the URI of the thumbnail.
40
-     */
41
-    public function renderUri(): string
42
-    {
43
-        // Makes sure the width and the height of the thumbnail is not bigger than the actual file
44
-        $configuration = $this->getConfiguration();
45
-        if (!empty($configuration['width']) && $configuration['width'] > $this->getFile()->getProperty('width')) {
46
-            $configuration['width'] = $this->getFile()->getProperty('width');
47
-        }
48
-        if (!empty($configuration['height']) && $configuration['height'] > $this->getFile()->getProperty('height')) {
49
-            $configuration['height'] = $this->getFile()->getProperty('height');
50
-        }
51
-
52
-        $configuration = $this->computeFinalImageDimension($configuration);
53
-        $this->processedFile = $this->getFile()->process($this->getProcessingType(), $configuration);
54
-        $uri = $this->processedFile->getPublicUrl(true);
55
-
56
-        // Update time stamp of processed image at this stage. This is needed for the browser to get new version of the thumbnail.
57
-        if ($this->processedFile->getProperty('originalfilesha1') !== $this->getFile()->getProperty('sha1')) {
58
-            $this->processedFile->updateProperties(array('tstamp' => $this->getFile()->getProperty('tstamp')));
59
-        }
60
-
61
-        return $this->prefixUri($uri);
62
-    }
63
-
64
-    /**
65
-     * Render the tag image which is the main one for a thumbnail.
66
-     *
67
-     * @param string $result
68
-     */
69
-    public function renderTagImage($result): string
70
-    {
71
-        // Variable $result corresponds to an URL in this case.
72
-        // Analyse the URL and compute the adequate separator between arguments.
73
-        $parameterSeparator = strpos($result, '?') === false ? '?' : '&';
74
-
75
-        return sprintf(
76
-            '<img src="%s%s" title="%s" alt="%s" %s/>',
77
-            $result,
78
-            $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->processedFile->getProperty('tstamp') : '',
79
-            $this->getTitle(),
80
-            $this->getTitle(),
81
-            $this->renderAttributes()
82
-        );
83
-    }
84
-
85
-    /**
86
-     * Compute and return the title of the file.
87
-     */
88
-    protected function getTitle(): string
89
-    {
90
-        $result = $this->getFile()->getProperty('title');
91
-        if (!$result) {
92
-            $result = $this->getFile()->getName();
93
-        }
94
-        return htmlspecialchars($result);
95
-    }
96
-
97
-    /**
98
-     * Render a wrapping anchor around the thumbnail.
99
-     *
100
-     * @param string $result
101
-     */
102
-    public function renderTagAnchor($result): string
103
-    {
104
-        $file = $this->getFile();
105
-
106
-        // Perhaps the wrapping file must be processed
107
-        $configurationWrap = $this->thumbnailService->getConfigurationWrap();
108
-
109
-        // Make sure we have configurationWrap initialized correctly
110
-        if (!empty($configurationWrap['width']) || !empty($configurationWrap['height'])) {
111
-            $configurationWrap = array_merge($this->defaultConfigurationWrap, $configurationWrap);
112
-
113
-            // It looks maxW or maxH does not work as expected with CONTEXT_IMAGEPREVIEW...
114
-            // ... uses "width" and "height" instead.
115
-            if ($configurationWrap['width'] < $this->getFile()->getProperty('width')
116
-                || $configurationWrap['height'] < $this->getFile()->getProperty('height')
117
-            ) {
118
-                $configurationWrap = $this->computeFinalImageDimension($configurationWrap);
119
-                $file = $this->getFile()->process($this->getProcessingType(), $configurationWrap);
120
-            }
121
-        }
122
-
123
-        // Analyse the current $url and compute the adequate separator between arguments.
124
-        $url = $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true);
125
-        $parameterSeparator = strpos($url, '?') === false ? '?' : '&';
126
-
127
-        return sprintf(
128
-            '<a href="%s%s" target="%s" data-uid="%s">%s</a>',
129
-            $url,
130
-            $this->thumbnailService->getAppendTimeStamp() && !$this->thumbnailService->getAnchorUri() ? $parameterSeparator . $file->getProperty('tstamp') : '',
131
-            $this->thumbnailService->getTarget(),
132
-            $file->getUid(),
133
-            $result
134
-        );
135
-    }
136
-
137
-    /**
138
-     * Compute the final configuration for the image preview.
139
-     * Keep ratio of width / height for the image.
140
-     *
141
-     * @param array $configuration
142
-     */
143
-    protected function computeFinalImageDimension(array $configuration): array
144
-    {
145
-        $ratio = $this->computeImageRatio();
146
-
147
-        if ($ratio > 1) {
148
-            $configuration['height'] = round($configuration['width'] / $ratio);
149
-        } else {
150
-            $configuration['width'] = round($configuration['height'] * $ratio);
151
-        }
152
-        return $configuration;
153
-    }
154
-
155
-    /**
156
-     * Compute the width / height ratio of the image.
157
-     *
158
-     * @return null|float
159
-     */
160
-    protected function computeImageRatio()
161
-    {
162
-        $ratio = null;
163
-        if ($this->getFile()->getProperty('width') > 0 && $this->getFile()->getProperty('height') > 0) {
164
-            $ratio = $this->getFile()->getProperty('width') / $this->getFile()->getProperty('height');
165
-        }
166
-        return $ratio;
167
-    }
168
-
169
-    /**
170
-     * @return string
171
-     */
172
-    public function getProcessingType(): string
173
-    {
174
-        if (!$this->thumbnailService->getProcessingType()) {
175
-            return ProcessedFile::CONTEXT_IMAGECROPSCALEMASK;
176
-        }
177
-        return $this->thumbnailService->getProcessingType();
178
-    }
18
+	protected array $defaultConfigurationWrap = [
19
+		'width' => 0,
20
+		'height' => 0,
21
+	];
22
+
23
+	/**
24
+	 * Render a thumbnail of a resource of type image.
25
+	 */
26
+	public function create(): string
27
+	{
28
+		$steps = $this->getRenderingSteps();
29
+
30
+		$result = '';
31
+		while ($step = array_shift($steps)) {
32
+			$result = $this->$step($result);
33
+		}
34
+
35
+		return $result;
36
+	}
37
+
38
+	/**
39
+	 * Render the URI of the thumbnail.
40
+	 */
41
+	public function renderUri(): string
42
+	{
43
+		// Makes sure the width and the height of the thumbnail is not bigger than the actual file
44
+		$configuration = $this->getConfiguration();
45
+		if (!empty($configuration['width']) && $configuration['width'] > $this->getFile()->getProperty('width')) {
46
+			$configuration['width'] = $this->getFile()->getProperty('width');
47
+		}
48
+		if (!empty($configuration['height']) && $configuration['height'] > $this->getFile()->getProperty('height')) {
49
+			$configuration['height'] = $this->getFile()->getProperty('height');
50
+		}
51
+
52
+		$configuration = $this->computeFinalImageDimension($configuration);
53
+		$this->processedFile = $this->getFile()->process($this->getProcessingType(), $configuration);
54
+		$uri = $this->processedFile->getPublicUrl(true);
55
+
56
+		// Update time stamp of processed image at this stage. This is needed for the browser to get new version of the thumbnail.
57
+		if ($this->processedFile->getProperty('originalfilesha1') !== $this->getFile()->getProperty('sha1')) {
58
+			$this->processedFile->updateProperties(array('tstamp' => $this->getFile()->getProperty('tstamp')));
59
+		}
60
+
61
+		return $this->prefixUri($uri);
62
+	}
63
+
64
+	/**
65
+	 * Render the tag image which is the main one for a thumbnail.
66
+	 *
67
+	 * @param string $result
68
+	 */
69
+	public function renderTagImage($result): string
70
+	{
71
+		// Variable $result corresponds to an URL in this case.
72
+		// Analyse the URL and compute the adequate separator between arguments.
73
+		$parameterSeparator = strpos($result, '?') === false ? '?' : '&';
74
+
75
+		return sprintf(
76
+			'<img src="%s%s" title="%s" alt="%s" %s/>',
77
+			$result,
78
+			$this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->processedFile->getProperty('tstamp') : '',
79
+			$this->getTitle(),
80
+			$this->getTitle(),
81
+			$this->renderAttributes()
82
+		);
83
+	}
84
+
85
+	/**
86
+	 * Compute and return the title of the file.
87
+	 */
88
+	protected function getTitle(): string
89
+	{
90
+		$result = $this->getFile()->getProperty('title');
91
+		if (!$result) {
92
+			$result = $this->getFile()->getName();
93
+		}
94
+		return htmlspecialchars($result);
95
+	}
96
+
97
+	/**
98
+	 * Render a wrapping anchor around the thumbnail.
99
+	 *
100
+	 * @param string $result
101
+	 */
102
+	public function renderTagAnchor($result): string
103
+	{
104
+		$file = $this->getFile();
105
+
106
+		// Perhaps the wrapping file must be processed
107
+		$configurationWrap = $this->thumbnailService->getConfigurationWrap();
108
+
109
+		// Make sure we have configurationWrap initialized correctly
110
+		if (!empty($configurationWrap['width']) || !empty($configurationWrap['height'])) {
111
+			$configurationWrap = array_merge($this->defaultConfigurationWrap, $configurationWrap);
112
+
113
+			// It looks maxW or maxH does not work as expected with CONTEXT_IMAGEPREVIEW...
114
+			// ... uses "width" and "height" instead.
115
+			if ($configurationWrap['width'] < $this->getFile()->getProperty('width')
116
+				|| $configurationWrap['height'] < $this->getFile()->getProperty('height')
117
+			) {
118
+				$configurationWrap = $this->computeFinalImageDimension($configurationWrap);
119
+				$file = $this->getFile()->process($this->getProcessingType(), $configurationWrap);
120
+			}
121
+		}
122
+
123
+		// Analyse the current $url and compute the adequate separator between arguments.
124
+		$url = $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true);
125
+		$parameterSeparator = strpos($url, '?') === false ? '?' : '&';
126
+
127
+		return sprintf(
128
+			'<a href="%s%s" target="%s" data-uid="%s">%s</a>',
129
+			$url,
130
+			$this->thumbnailService->getAppendTimeStamp() && !$this->thumbnailService->getAnchorUri() ? $parameterSeparator . $file->getProperty('tstamp') : '',
131
+			$this->thumbnailService->getTarget(),
132
+			$file->getUid(),
133
+			$result
134
+		);
135
+	}
136
+
137
+	/**
138
+	 * Compute the final configuration for the image preview.
139
+	 * Keep ratio of width / height for the image.
140
+	 *
141
+	 * @param array $configuration
142
+	 */
143
+	protected function computeFinalImageDimension(array $configuration): array
144
+	{
145
+		$ratio = $this->computeImageRatio();
146
+
147
+		if ($ratio > 1) {
148
+			$configuration['height'] = round($configuration['width'] / $ratio);
149
+		} else {
150
+			$configuration['width'] = round($configuration['height'] * $ratio);
151
+		}
152
+		return $configuration;
153
+	}
154
+
155
+	/**
156
+	 * Compute the width / height ratio of the image.
157
+	 *
158
+	 * @return null|float
159
+	 */
160
+	protected function computeImageRatio()
161
+	{
162
+		$ratio = null;
163
+		if ($this->getFile()->getProperty('width') > 0 && $this->getFile()->getProperty('height') > 0) {
164
+			$ratio = $this->getFile()->getProperty('width') / $this->getFile()->getProperty('height');
165
+		}
166
+		return $ratio;
167
+	}
168
+
169
+	/**
170
+	 * @return string
171
+	 */
172
+	public function getProcessingType(): string
173
+	{
174
+		if (!$this->thumbnailService->getProcessingType()) {
175
+			return ProcessedFile::CONTEXT_IMAGECROPSCALEMASK;
176
+		}
177
+		return $this->thumbnailService->getProcessingType();
178
+	}
179 179
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         return sprintf(
76 76
             '<img src="%s%s" title="%s" alt="%s" %s/>',
77 77
             $result,
78
-            $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->processedFile->getProperty('tstamp') : '',
78
+            $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator.$this->processedFile->getProperty('tstamp') : '',
79 79
             $this->getTitle(),
80 80
             $this->getTitle(),
81 81
             $this->renderAttributes()
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         return sprintf(
128 128
             '<a href="%s%s" target="%s" data-uid="%s">%s</a>',
129 129
             $url,
130
-            $this->thumbnailService->getAppendTimeStamp() && !$this->thumbnailService->getAnchorUri() ? $parameterSeparator . $file->getProperty('tstamp') : '',
130
+            $this->thumbnailService->getAppendTimeStamp() && !$this->thumbnailService->getAnchorUri() ? $parameterSeparator.$file->getProperty('tstamp') : '',
131 131
             $this->thumbnailService->getTarget(),
132 132
             $file->getUid(),
133 133
             $result
Please login to merge, or discard this patch.
Classes/Thumbnail/AbstractThumbnailProcessor.php 2 patches
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -23,134 +23,134 @@
 block discarded – undo
23 23
  */
24 24
 abstract class AbstractThumbnailProcessor implements ThumbnailProcessorInterface
25 25
 {
26
-    /**
27
-     * @var ThumbnailService
28
-     */
29
-    protected $thumbnailService;
30
-
31
-    /**
32
-     * Store a Processed File along the processing.
33
-     *
34
-     * @var ProcessedFile
35
-     */
36
-    protected $processedFile;
37
-
38
-    /**
39
-     * Define what are the rendering steps for a thumbnail.
40
-     */
41
-    protected array $renderingSteps = [
42
-        ThumbnailInterface::OUTPUT_URI => 'renderUri',
43
-        ThumbnailInterface::OUTPUT_IMAGE => 'renderTagImage',
44
-        ThumbnailInterface::OUTPUT_IMAGE_WRAPPED => 'renderTagAnchor',
45
-    ];
46
-
47
-    public function setThumbnailService(ThumbnailService $thumbnailService): AbstractThumbnailProcessor
48
-    {
49
-        $this->thumbnailService = $thumbnailService;
50
-        return $this;
51
-    }
52
-
53
-    /**
54
-     * Return what needs to be rendered
55
-     */
56
-    protected function getRenderingSteps(): array
57
-    {
58
-        $position = array_search($this->thumbnailService->getOutputType(), array_keys($this->renderingSteps));
59
-        return array_slice($this->renderingSteps, 0, $position + 1);
60
-    }
61
-
62
-
63
-    /**
64
-     * Render additional attribute for this DOM element.
65
-     */
66
-    protected function renderAttributes(): string
67
-    {
68
-        $result = '';
69
-        $attributes = $this->thumbnailService->getAttributes();
70
-        if (is_array($attributes)) {
71
-            foreach ($attributes as $attribute => $value) {
72
-                $result .= sprintf(
73
-                    '%s="%s" ',
74
-                    htmlspecialchars($attribute),
75
-                    htmlspecialchars($value)
76
-                );
77
-            }
78
-        }
79
-        return $result;
80
-    }
81
-
82
-    protected function getConfiguration(): array
83
-    {
84
-        $configuration = $this->thumbnailService->getConfiguration();
85
-        if (!$configuration) {
86
-            $dimension = ImagePresetUtility::getInstance()->preset('image_thumbnail');
87
-            $configuration = array(
88
-                'width' => $dimension->getWidth(),
89
-                'height' => $dimension->getHeight(),
90
-            );
91
-        }
92
-        return $configuration;
93
-    }
94
-
95
-    /**
96
-     * Returns a path to an icon given an extension.
97
-     *
98
-     * @param string $extension File extension
99
-     */
100
-    protected function getIcon($extension): string
101
-    {
102
-        $resource = Path::getRelativePath(sprintf('Icons/MimeType/%s.png', $extension));
103
-
104
-        // If file is not found, fall back to a default icon
105
-        if (Path::notExists($resource)) {
106
-            $resource = Path::getRelativePath('Icons/MissingMimeTypeIcon.png');
107
-        }
108
-
109
-        return $resource;
110
-    }
111
-
112
-    /**
113
-     * @param string $uri
114
-     */
115
-    public function prefixUri($uri): string
116
-    {
117
-        if ($this->isFrontendMode() && $this->getFrontendObject()->absRefPrefix) {
118
-            $uri = $this->getFrontendObject()->absRefPrefix . $uri;
119
-        }
120
-        return $uri;
121
-    }
122
-
123
-    /**
124
-     * Returns true whether an thumbnail can be generated
125
-     *
126
-     * @param string $extension File extension
127
-     * @return boolean
128
-     */
129
-    protected function isThumbnailPossible($extension): bool
130
-    {
131
-        return GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], strtolower($extension));
132
-    }
133
-
134
-    /**
135
-     * @return File
136
-     */
137
-    protected function getFile(): File
138
-    {
139
-        return $this->thumbnailService->getFile();
140
-    }
141
-
142
-    /**
143
-     * Returns whether the current mode is Frontend
144
-     *
145
-     * @return bool
146
-     */
147
-    protected function isFrontendMode(): bool
148
-    {
149
-        return !Environment::isCli() && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend();
150
-    }
151
-
152
-    protected function getFrontendObject(): TypoScriptFrontendController
153
-    {
154
-        return $GLOBALS['TSFE'];
155
-    }
26
+	/**
27
+	 * @var ThumbnailService
28
+	 */
29
+	protected $thumbnailService;
30
+
31
+	/**
32
+	 * Store a Processed File along the processing.
33
+	 *
34
+	 * @var ProcessedFile
35
+	 */
36
+	protected $processedFile;
37
+
38
+	/**
39
+	 * Define what are the rendering steps for a thumbnail.
40
+	 */
41
+	protected array $renderingSteps = [
42
+		ThumbnailInterface::OUTPUT_URI => 'renderUri',
43
+		ThumbnailInterface::OUTPUT_IMAGE => 'renderTagImage',
44
+		ThumbnailInterface::OUTPUT_IMAGE_WRAPPED => 'renderTagAnchor',
45
+	];
46
+
47
+	public function setThumbnailService(ThumbnailService $thumbnailService): AbstractThumbnailProcessor
48
+	{
49
+		$this->thumbnailService = $thumbnailService;
50
+		return $this;
51
+	}
52
+
53
+	/**
54
+	 * Return what needs to be rendered
55
+	 */
56
+	protected function getRenderingSteps(): array
57
+	{
58
+		$position = array_search($this->thumbnailService->getOutputType(), array_keys($this->renderingSteps));
59
+		return array_slice($this->renderingSteps, 0, $position + 1);
60
+	}
61
+
62
+
63
+	/**
64
+	 * Render additional attribute for this DOM element.
65
+	 */
66
+	protected function renderAttributes(): string
67
+	{
68
+		$result = '';
69
+		$attributes = $this->thumbnailService->getAttributes();
70
+		if (is_array($attributes)) {
71
+			foreach ($attributes as $attribute => $value) {
72
+				$result .= sprintf(
73
+					'%s="%s" ',
74
+					htmlspecialchars($attribute),
75
+					htmlspecialchars($value)
76
+				);
77
+			}
78
+		}
79
+		return $result;
80
+	}
81
+
82
+	protected function getConfiguration(): array
83
+	{
84
+		$configuration = $this->thumbnailService->getConfiguration();
85
+		if (!$configuration) {
86
+			$dimension = ImagePresetUtility::getInstance()->preset('image_thumbnail');
87
+			$configuration = array(
88
+				'width' => $dimension->getWidth(),
89
+				'height' => $dimension->getHeight(),
90
+			);
91
+		}
92
+		return $configuration;
93
+	}
94
+
95
+	/**
96
+	 * Returns a path to an icon given an extension.
97
+	 *
98
+	 * @param string $extension File extension
99
+	 */
100
+	protected function getIcon($extension): string
101
+	{
102
+		$resource = Path::getRelativePath(sprintf('Icons/MimeType/%s.png', $extension));
103
+
104
+		// If file is not found, fall back to a default icon
105
+		if (Path::notExists($resource)) {
106
+			$resource = Path::getRelativePath('Icons/MissingMimeTypeIcon.png');
107
+		}
108
+
109
+		return $resource;
110
+	}
111
+
112
+	/**
113
+	 * @param string $uri
114
+	 */
115
+	public function prefixUri($uri): string
116
+	{
117
+		if ($this->isFrontendMode() && $this->getFrontendObject()->absRefPrefix) {
118
+			$uri = $this->getFrontendObject()->absRefPrefix . $uri;
119
+		}
120
+		return $uri;
121
+	}
122
+
123
+	/**
124
+	 * Returns true whether an thumbnail can be generated
125
+	 *
126
+	 * @param string $extension File extension
127
+	 * @return boolean
128
+	 */
129
+	protected function isThumbnailPossible($extension): bool
130
+	{
131
+		return GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], strtolower($extension));
132
+	}
133
+
134
+	/**
135
+	 * @return File
136
+	 */
137
+	protected function getFile(): File
138
+	{
139
+		return $this->thumbnailService->getFile();
140
+	}
141
+
142
+	/**
143
+	 * Returns whether the current mode is Frontend
144
+	 *
145
+	 * @return bool
146
+	 */
147
+	protected function isFrontendMode(): bool
148
+	{
149
+		return !Environment::isCli() && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend();
150
+	}
151
+
152
+	protected function getFrontendObject(): TypoScriptFrontendController
153
+	{
154
+		return $GLOBALS['TSFE'];
155
+	}
156 156
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
     public function prefixUri($uri): string
116 116
     {
117 117
         if ($this->isFrontendMode() && $this->getFrontendObject()->absRefPrefix) {
118
-            $uri = $this->getFrontendObject()->absRefPrefix . $uri;
118
+            $uri = $this->getFrontendObject()->absRefPrefix.$uri;
119 119
         }
120 120
         return $uri;
121 121
     }
Please login to merge, or discard this patch.
Classes/Thumbnail/ThumbnailService.php 1 patch
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -20,247 +20,247 @@
 block discarded – undo
20 20
  */
21 21
 class ThumbnailService
22 22
 {
23
-    protected array $allowedOutputTypes = [
24
-        ThumbnailInterface::OUTPUT_IMAGE,
25
-        ThumbnailInterface::OUTPUT_IMAGE_WRAPPED,
26
-        ThumbnailInterface::OUTPUT_URI,
27
-    ];
28
-
29
-    /**
30
-     * Configure the output of the thumbnail service whether it is wrapped or not.
31
-     * Default output is: ThumbnailInterface::OUTPUT_IMAGE
32
-     */
33
-    protected string $outputType = ThumbnailInterface::OUTPUT_IMAGE;
34
-
35
-    protected ?File $file = null;
36
-
37
-    /**
38
-     * Define width, height and all sort of attributes to render a thumbnail.
39
-     * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image
40
-     * @var array
41
-     */
42
-    protected array $configuration = [];
43
-
44
-    /**
45
-     * Define width, height and all sort of attributes to render the anchor file
46
-     * which is wrapping the image
47
-     *
48
-     * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image
49
-     * @var array
50
-     */
51
-    protected array $configurationWrap = [];
52
-
53
-    /**
54
-     * DOM attributes to add to the image preview.
55
-     *
56
-     * @var array
57
-     */
58
-    protected array $attributes = [
59
-        'class' => 'thumbnail',
60
-    ];
61
-
62
-    /**
63
-     * Define in which window will the thumbnail be opened.
64
-     * Does only apply if the thumbnail is wrapped (with an anchor).
65
-     */
66
-    protected string $target = ThumbnailInterface::TARGET_BLANK;
67
-
68
-    /**
69
-     * URI of the wrapping anchor pointing to the file.
70
-     * replacing the "?" <a href="?">...</a>
71
-     * The URI is automatically computed if not set.
72
-     */
73
-    protected string $anchorUri = '';
74
-
75
-    /**
76
-     * Whether a time stamp is appended to the image.
77
-     * Appending the time stamp can prevent caching
78
-     */
79
-    protected bool $appendTimeStamp = false;
80
-
81
-    /**
82
-     * Define the processing type for the thumbnail.
83
-     * As instance for image the default is ProcessedFile::CONTEXT_IMAGECROPSCALEMASK.
84
-     */
85
-    protected string $processingType = '';
86
-
87
-    public function __construct(File $file = null)
88
-    {
89
-        $this->file = $file;
90
-    }
91
-
92
-    /**
93
-     * Render a thumbnail of a media
94
-     */
95
-    public function create(): string
96
-    {
97
-        if (!$this->file) {
98
-            throw new MissingTcaConfigurationException('Missing File object. Forgotten to set a file?', 1355933144);
99
-        }
100
-
101
-        // Default class name
102
-        $className = FallBackThumbnailProcessor::class;
103
-        if (File::FILETYPE_IMAGE === $this->file->getType()) {
104
-            $className = ImageThumbnailProcessor::class;
105
-        } elseif (File::FILETYPE_AUDIO === $this->file->getType()) {
106
-            $className = AudioThumbnailProcessor::class;
107
-        } elseif (File::FILETYPE_VIDEO === $this->file->getType()) {
108
-            $className = VideoThumbnailProcessor::class;
109
-        } elseif (File::FILETYPE_APPLICATION === $this->file->getType() || File::FILETYPE_TEXT === $this->file->getType()) {
110
-            $className = ApplicationThumbnailProcessor::class;
111
-        }
112
-
113
-        /** @var $processorInstance \Fab\Media\Thumbnail\ThumbnailProcessorInterface */
114
-        $processorInstance = GeneralUtility::makeInstance($className);
115
-
116
-        $thumbnail = '';
117
-        if ($this->file->exists()) {
118
-            $thumbnail = $processorInstance->setThumbnailService($this)->create();
119
-        } else {
120
-            $logger = Logger::getInstance($this);
121
-            $logger->warning(sprintf('Resource not found for File uid "%s" at %s', $this->file->getUid(), $this->file->getIdentifier()));
122
-        }
123
-
124
-        return $thumbnail;
125
-    }
126
-
127
-    /**
128
-     * @return array
129
-     */
130
-    public function getConfigurationWrap(): array
131
-    {
132
-        return $this->configurationWrap;
133
-    }
134
-
135
-    /**
136
-     * @param array $configurationWrap
137
-     * @return $this
138
-     */
139
-    public function setConfigurationWrap($configurationWrap): ThumbnailService
140
-    {
141
-        $this->configurationWrap = $configurationWrap;
142
-        return $this;
143
-    }
144
-
145
-    /**
146
-     * @return mixed
147
-     */
148
-    public function getFile()
149
-    {
150
-        return $this->file;
151
-    }
152
-
153
-    /**
154
-     * @return array
155
-     */
156
-    public function getConfiguration(): array
157
-    {
158
-        return $this->configuration;
159
-    }
160
-
161
-    /**
162
-     * @param array|ThumbnailConfiguration $configuration
163
-     * @return $this
164
-     */
165
-    public function setConfiguration($configuration): ThumbnailService
166
-    {
167
-        if ($configuration instanceof ThumbnailConfiguration) {
168
-            $configurationObject = $configuration;
169
-            $configuration = [];
170
-
171
-            if ($configurationObject->getWidth() > 0) {
172
-                $configuration['width'] = $configurationObject->getWidth();
173
-            }
174
-
175
-            if ($configurationObject->getHeight() > 0) {
176
-                $configuration['height'] = $configurationObject->getHeight();
177
-            }
178
-
179
-            if ($configurationObject->getStyle()) {
180
-                $this->attributes['style'] = $configurationObject->getStyle();
181
-            }
182
-
183
-            if ($configurationObject->getClassName()) {
184
-                $this->attributes['class'] = $configurationObject->getClassName();
185
-            }
186
-        }
187
-
188
-        $this->configuration = $configuration;
189
-        return $this;
190
-    }
191
-
192
-    public function getAttributes(): array
193
-    {
194
-        return $this->attributes;
195
-    }
196
-
197
-    public function setAttributes(array $attributes): ThumbnailService
198
-    {
199
-        $this->attributes = $attributes;
200
-        return $this;
201
-    }
202
-
203
-    public function getOutputType(): string
204
-    {
205
-        return $this->outputType;
206
-    }
207
-
208
-    public function setOutputType(string $outputType): ThumbnailService
209
-    {
210
-        if (!in_array($outputType, $this->allowedOutputTypes)) {
211
-            throw new InvalidKeyInArrayException(
212
-                sprintf('Output type "%s" is not allowed', $outputType),
213
-                1373020076
214
-            );
215
-        }
216
-        $this->outputType = $outputType;
217
-        return $this;
218
-    }
219
-
220
-    public function getTarget(): string
221
-    {
222
-        return $this->target;
223
-    }
224
-
225
-    public function setTarget(string $target): ThumbnailService
226
-    {
227
-        $this->target = $target;
228
-        return $this;
229
-    }
230
-
231
-    public function getAnchorUri(): string
232
-    {
233
-        return $this->anchorUri;
234
-    }
235
-
236
-    public function setAnchorUri(string $anchorUri): ThumbnailService
237
-    {
238
-        $this->anchorUri = $anchorUri;
239
-        return $this;
240
-    }
241
-
242
-    public function getAppendTimeStamp(): bool
243
-    {
244
-        return $this->appendTimeStamp;
245
-    }
246
-
247
-    /**
248
-     * @param boolean $appendTimeStamp
249
-     */
250
-    public function setAppendTimeStamp($appendTimeStamp): ThumbnailService
251
-    {
252
-        $this->appendTimeStamp = (bool)$appendTimeStamp;
253
-        return $this;
254
-    }
255
-
256
-    public function getProcessingType(): string
257
-    {
258
-        return $this->processingType;
259
-    }
260
-
261
-    public function setProcessingType(string $processingType): ThumbnailService
262
-    {
263
-        $this->processingType = $processingType;
264
-        return $this;
265
-    }
23
+	protected array $allowedOutputTypes = [
24
+		ThumbnailInterface::OUTPUT_IMAGE,
25
+		ThumbnailInterface::OUTPUT_IMAGE_WRAPPED,
26
+		ThumbnailInterface::OUTPUT_URI,
27
+	];
28
+
29
+	/**
30
+	 * Configure the output of the thumbnail service whether it is wrapped or not.
31
+	 * Default output is: ThumbnailInterface::OUTPUT_IMAGE
32
+	 */
33
+	protected string $outputType = ThumbnailInterface::OUTPUT_IMAGE;
34
+
35
+	protected ?File $file = null;
36
+
37
+	/**
38
+	 * Define width, height and all sort of attributes to render a thumbnail.
39
+	 * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image
40
+	 * @var array
41
+	 */
42
+	protected array $configuration = [];
43
+
44
+	/**
45
+	 * Define width, height and all sort of attributes to render the anchor file
46
+	 * which is wrapping the image
47
+	 *
48
+	 * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image
49
+	 * @var array
50
+	 */
51
+	protected array $configurationWrap = [];
52
+
53
+	/**
54
+	 * DOM attributes to add to the image preview.
55
+	 *
56
+	 * @var array
57
+	 */
58
+	protected array $attributes = [
59
+		'class' => 'thumbnail',
60
+	];
61
+
62
+	/**
63
+	 * Define in which window will the thumbnail be opened.
64
+	 * Does only apply if the thumbnail is wrapped (with an anchor).
65
+	 */
66
+	protected string $target = ThumbnailInterface::TARGET_BLANK;
67
+
68
+	/**
69
+	 * URI of the wrapping anchor pointing to the file.
70
+	 * replacing the "?" <a href="?">...</a>
71
+	 * The URI is automatically computed if not set.
72
+	 */
73
+	protected string $anchorUri = '';
74
+
75
+	/**
76
+	 * Whether a time stamp is appended to the image.
77
+	 * Appending the time stamp can prevent caching
78
+	 */
79
+	protected bool $appendTimeStamp = false;
80
+
81
+	/**
82
+	 * Define the processing type for the thumbnail.
83
+	 * As instance for image the default is ProcessedFile::CONTEXT_IMAGECROPSCALEMASK.
84
+	 */
85
+	protected string $processingType = '';
86
+
87
+	public function __construct(File $file = null)
88
+	{
89
+		$this->file = $file;
90
+	}
91
+
92
+	/**
93
+	 * Render a thumbnail of a media
94
+	 */
95
+	public function create(): string
96
+	{
97
+		if (!$this->file) {
98
+			throw new MissingTcaConfigurationException('Missing File object. Forgotten to set a file?', 1355933144);
99
+		}
100
+
101
+		// Default class name
102
+		$className = FallBackThumbnailProcessor::class;
103
+		if (File::FILETYPE_IMAGE === $this->file->getType()) {
104
+			$className = ImageThumbnailProcessor::class;
105
+		} elseif (File::FILETYPE_AUDIO === $this->file->getType()) {
106
+			$className = AudioThumbnailProcessor::class;
107
+		} elseif (File::FILETYPE_VIDEO === $this->file->getType()) {
108
+			$className = VideoThumbnailProcessor::class;
109
+		} elseif (File::FILETYPE_APPLICATION === $this->file->getType() || File::FILETYPE_TEXT === $this->file->getType()) {
110
+			$className = ApplicationThumbnailProcessor::class;
111
+		}
112
+
113
+		/** @var $processorInstance \Fab\Media\Thumbnail\ThumbnailProcessorInterface */
114
+		$processorInstance = GeneralUtility::makeInstance($className);
115
+
116
+		$thumbnail = '';
117
+		if ($this->file->exists()) {
118
+			$thumbnail = $processorInstance->setThumbnailService($this)->create();
119
+		} else {
120
+			$logger = Logger::getInstance($this);
121
+			$logger->warning(sprintf('Resource not found for File uid "%s" at %s', $this->file->getUid(), $this->file->getIdentifier()));
122
+		}
123
+
124
+		return $thumbnail;
125
+	}
126
+
127
+	/**
128
+	 * @return array
129
+	 */
130
+	public function getConfigurationWrap(): array
131
+	{
132
+		return $this->configurationWrap;
133
+	}
134
+
135
+	/**
136
+	 * @param array $configurationWrap
137
+	 * @return $this
138
+	 */
139
+	public function setConfigurationWrap($configurationWrap): ThumbnailService
140
+	{
141
+		$this->configurationWrap = $configurationWrap;
142
+		return $this;
143
+	}
144
+
145
+	/**
146
+	 * @return mixed
147
+	 */
148
+	public function getFile()
149
+	{
150
+		return $this->file;
151
+	}
152
+
153
+	/**
154
+	 * @return array
155
+	 */
156
+	public function getConfiguration(): array
157
+	{
158
+		return $this->configuration;
159
+	}
160
+
161
+	/**
162
+	 * @param array|ThumbnailConfiguration $configuration
163
+	 * @return $this
164
+	 */
165
+	public function setConfiguration($configuration): ThumbnailService
166
+	{
167
+		if ($configuration instanceof ThumbnailConfiguration) {
168
+			$configurationObject = $configuration;
169
+			$configuration = [];
170
+
171
+			if ($configurationObject->getWidth() > 0) {
172
+				$configuration['width'] = $configurationObject->getWidth();
173
+			}
174
+
175
+			if ($configurationObject->getHeight() > 0) {
176
+				$configuration['height'] = $configurationObject->getHeight();
177
+			}
178
+
179
+			if ($configurationObject->getStyle()) {
180
+				$this->attributes['style'] = $configurationObject->getStyle();
181
+			}
182
+
183
+			if ($configurationObject->getClassName()) {
184
+				$this->attributes['class'] = $configurationObject->getClassName();
185
+			}
186
+		}
187
+
188
+		$this->configuration = $configuration;
189
+		return $this;
190
+	}
191
+
192
+	public function getAttributes(): array
193
+	{
194
+		return $this->attributes;
195
+	}
196
+
197
+	public function setAttributes(array $attributes): ThumbnailService
198
+	{
199
+		$this->attributes = $attributes;
200
+		return $this;
201
+	}
202
+
203
+	public function getOutputType(): string
204
+	{
205
+		return $this->outputType;
206
+	}
207
+
208
+	public function setOutputType(string $outputType): ThumbnailService
209
+	{
210
+		if (!in_array($outputType, $this->allowedOutputTypes)) {
211
+			throw new InvalidKeyInArrayException(
212
+				sprintf('Output type "%s" is not allowed', $outputType),
213
+				1373020076
214
+			);
215
+		}
216
+		$this->outputType = $outputType;
217
+		return $this;
218
+	}
219
+
220
+	public function getTarget(): string
221
+	{
222
+		return $this->target;
223
+	}
224
+
225
+	public function setTarget(string $target): ThumbnailService
226
+	{
227
+		$this->target = $target;
228
+		return $this;
229
+	}
230
+
231
+	public function getAnchorUri(): string
232
+	{
233
+		return $this->anchorUri;
234
+	}
235
+
236
+	public function setAnchorUri(string $anchorUri): ThumbnailService
237
+	{
238
+		$this->anchorUri = $anchorUri;
239
+		return $this;
240
+	}
241
+
242
+	public function getAppendTimeStamp(): bool
243
+	{
244
+		return $this->appendTimeStamp;
245
+	}
246
+
247
+	/**
248
+	 * @param boolean $appendTimeStamp
249
+	 */
250
+	public function setAppendTimeStamp($appendTimeStamp): ThumbnailService
251
+	{
252
+		$this->appendTimeStamp = (bool)$appendTimeStamp;
253
+		return $this;
254
+	}
255
+
256
+	public function getProcessingType(): string
257
+	{
258
+		return $this->processingType;
259
+	}
260
+
261
+	public function setProcessingType(string $processingType): ThumbnailService
262
+	{
263
+		$this->processingType = $processingType;
264
+		return $this;
265
+	}
266 266
 }
Please login to merge, or discard this patch.
Classes/Thumbnail/ThumbnailProcessorInterface.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -14,39 +14,39 @@
 block discarded – undo
14 14
  */
15 15
 interface ThumbnailProcessorInterface
16 16
 {
17
-    /**
18
-     * @param ThumbnailService $thumbnailService
19
-     * @return $this
20
-     */
21
-    public function setThumbnailService(ThumbnailService $thumbnailService);
17
+	/**
18
+	 * @param ThumbnailService $thumbnailService
19
+	 * @return $this
20
+	 */
21
+	public function setThumbnailService(ThumbnailService $thumbnailService);
22 22
 
23
-    /**
24
-     * Render a thumbnail.
25
-     *
26
-     * @return string
27
-     */
28
-    public function create();
23
+	/**
24
+	 * Render a thumbnail.
25
+	 *
26
+	 * @return string
27
+	 */
28
+	public function create();
29 29
 
30
-    /**
31
-     * Render the URI of the thumbnail.
32
-     *
33
-     * @return string
34
-     */
35
-    public function renderUri();
30
+	/**
31
+	 * Render the URI of the thumbnail.
32
+	 *
33
+	 * @return string
34
+	 */
35
+	public function renderUri();
36 36
 
37
-    /**
38
-     * Render the tag image which is the main one for a thumbnail.
39
-     *
40
-     * @param string $result
41
-     * @return string
42
-     */
43
-    public function renderTagImage($result);
37
+	/**
38
+	 * Render the tag image which is the main one for a thumbnail.
39
+	 *
40
+	 * @param string $result
41
+	 * @return string
42
+	 */
43
+	public function renderTagImage($result);
44 44
 
45
-    /**
46
-     * Render a wrapping anchor around the thumbnail.
47
-     *
48
-     * @param string $result
49
-     * @return string
50
-     */
51
-    public function renderTagAnchor($result);
45
+	/**
46
+	 * Render a wrapping anchor around the thumbnail.
47
+	 *
48
+	 * @param string $result
49
+	 * @return string
50
+	 */
51
+	public function renderTagAnchor($result);
52 52
 }
Please login to merge, or discard this patch.
Classes/Thumbnail/VideoThumbnailProcessor.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -17,93 +17,93 @@
 block discarded – undo
17 17
  */
18 18
 class VideoThumbnailProcessor extends AbstractThumbnailProcessor
19 19
 {
20
-    /**
21
-     * Render a thumbnail of a resource of type video.
22
-     *
23
-     * @return string
24
-     */
25
-    public function create()
26
-    {
27
-        $steps = $this->getRenderingSteps();
20
+	/**
21
+	 * Render a thumbnail of a resource of type video.
22
+	 *
23
+	 * @return string
24
+	 */
25
+	public function create()
26
+	{
27
+		$steps = $this->getRenderingSteps();
28 28
 
29
-        $result = '';
30
-        while ($step = array_shift($steps)) {
31
-            $result = $this->$step($result);
32
-        }
29
+		$result = '';
30
+		while ($step = array_shift($steps)) {
31
+			$result = $this->$step($result);
32
+		}
33 33
 
34
-        return $result;
35
-    }
34
+		return $result;
35
+	}
36 36
 
37
-    /**
38
-     * Render the URI of the thumbnail.
39
-     *
40
-     * @return string
41
-     */
42
-    public function renderUri()
43
-    {
44
-        $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension'));
45
-        $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath);
46
-        if (!file_exists($fileNameAndPath)) {
47
-            $relativePath = 'Icons/UnknownMimeType.png';
48
-        }
37
+	/**
38
+	 * Render the URI of the thumbnail.
39
+	 *
40
+	 * @return string
41
+	 */
42
+	public function renderUri()
43
+	{
44
+		$relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension'));
45
+		$fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath);
46
+		if (!file_exists($fileNameAndPath)) {
47
+			$relativePath = 'Icons/UnknownMimeType.png';
48
+		}
49 49
 
50
-        $uri = Path::getRelativePath($relativePath);
51
-        return $this->prefixUri($uri);
52
-    }
50
+		$uri = Path::getRelativePath($relativePath);
51
+		return $this->prefixUri($uri);
52
+	}
53 53
 
54
-    /**
55
-     * Render the tag image which is the main one for a thumbnail.
56
-     *
57
-     * @param string $result
58
-     * @return string
59
-     */
60
-    public function renderTagImage($result)
61
-    {
62
-        // Variable $result corresponds to an URL in this case.
63
-        // Analyse the URL and compute the adequate separator between arguments.
64
-        $parameterSeparator = strpos($result, '?') === false ? '?' : '&';
54
+	/**
55
+	 * Render the tag image which is the main one for a thumbnail.
56
+	 *
57
+	 * @param string $result
58
+	 * @return string
59
+	 */
60
+	public function renderTagImage($result)
61
+	{
62
+		// Variable $result corresponds to an URL in this case.
63
+		// Analyse the URL and compute the adequate separator between arguments.
64
+		$parameterSeparator = strpos($result, '?') === false ? '?' : '&';
65 65
 
66
-        return sprintf(
67
-            '<img src="%s%s" title="%s" alt="%s" %s/>',
68
-            $result,
69
-            $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '',
70
-            $this->getTitle(),
71
-            $this->getTitle(),
72
-            $this->renderAttributes()
73
-        );
74
-    }
66
+		return sprintf(
67
+			'<img src="%s%s" title="%s" alt="%s" %s/>',
68
+			$result,
69
+			$this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '',
70
+			$this->getTitle(),
71
+			$this->getTitle(),
72
+			$this->renderAttributes()
73
+		);
74
+	}
75 75
 
76
-    /**
77
-     * Compute and return the title of the file.
78
-     *
79
-     * @return string
80
-     */
81
-    protected function getTitle()
82
-    {
83
-        $result = $this->getFile()->getProperty('title');
84
-        if (!$result) {
85
-            $result = $this->getFile()->getName();
86
-        }
87
-        return htmlspecialchars($result);
88
-    }
76
+	/**
77
+	 * Compute and return the title of the file.
78
+	 *
79
+	 * @return string
80
+	 */
81
+	protected function getTitle()
82
+	{
83
+		$result = $this->getFile()->getProperty('title');
84
+		if (!$result) {
85
+			$result = $this->getFile()->getName();
86
+		}
87
+		return htmlspecialchars($result);
88
+	}
89 89
 
90
-    /**
91
-     * Render a wrapping anchor around the thumbnail.
92
-     *
93
-     * @param string $result
94
-     * @return string
95
-     */
96
-    public function renderTagAnchor($result)
97
-    {
98
-        $file = $this->getFile();
90
+	/**
91
+	 * Render a wrapping anchor around the thumbnail.
92
+	 *
93
+	 * @param string $result
94
+	 * @return string
95
+	 */
96
+	public function renderTagAnchor($result)
97
+	{
98
+		$file = $this->getFile();
99 99
 
100
-        return sprintf(
101
-            '<a href="%s%s" target="%s" data-uid="%s">%s</a>',
102
-            $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true),
103
-            $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '',
104
-            $this->thumbnailService->getTarget(),
105
-            $file->getUid(),
106
-            $result
107
-        );
108
-    }
100
+		return sprintf(
101
+			'<a href="%s%s" target="%s" data-uid="%s">%s</a>',
102
+			$this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true),
103
+			$this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '',
104
+			$this->thumbnailService->getTarget(),
105
+			$file->getUid(),
106
+			$result
107
+		);
108
+	}
109 109
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public function renderUri()
43 43
     {
44 44
         $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension'));
45
-        $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath);
45
+        $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/'.$relativePath);
46 46
         if (!file_exists($fileNameAndPath)) {
47 47
             $relativePath = 'Icons/UnknownMimeType.png';
48 48
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         return sprintf(
67 67
             '<img src="%s%s" title="%s" alt="%s" %s/>',
68 68
             $result,
69
-            $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '',
69
+            $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator.$this->getFile()->getProperty('tstamp') : '',
70 70
             $this->getTitle(),
71 71
             $this->getTitle(),
72 72
             $this->renderAttributes()
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         return sprintf(
101 101
             '<a href="%s%s" target="%s" data-uid="%s">%s</a>',
102 102
             $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true),
103
-            $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '',
103
+            $this->thumbnailService->getAppendTimeStamp() ? '?'.$file->getProperty('tstamp') : '',
104 104
             $this->thumbnailService->getTarget(),
105 105
             $file->getUid(),
106 106
             $result
Please login to merge, or discard this patch.
Classes/Thumbnail/ThumbnailGenerator.php 1 patch
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -22,182 +22,182 @@
 block discarded – undo
22 22
  */
23 23
 class ThumbnailGenerator
24 24
 {
25
-    protected int $numberOfTraversedFiles = 0;
26
-
27
-    protected int $numberOfProcessedFiles = 0;
28
-
29
-    protected int $numberOfMissingFiles = 0;
30
-
31
-    protected array $configuration = [];
32
-
33
-    protected ?ResourceStorage $storage = null;
34
-
35
-    protected ?Selection $selection = null;
36
-
37
-    protected array $resultSet = [];
38
-
39
-    protected array $newProcessedFileIdentifiers = [];
40
-
41
-    protected int $lastInsertedProcessedFile = 0;
42
-
43
-    protected int $limit = 0;
44
-
45
-    protected int $offset = 0;
46
-
47
-    public function generate(int $limit = 0, int $offset = 0): void
48
-    {
49
-        $this->limit = $limit;
50
-        $this->offset = $offset;
51
-
52
-        // Compute a possible limit and offset for the query.
53
-        $rows = $this->getDataService()
54
-            ->getRecords(
55
-                'sys_file',
56
-                [
57
-                    'storage' => $this->storage->getUid()
58
-                ],
59
-                $limit,
60
-                $offset
61
-            );
62
-
63
-        foreach ($rows as $row) {
64
-            $file = $this->getResourceFactory()->getFileObject($row['uid'], $row);
65
-
66
-            if ($file->exists()) {
67
-                $thumbnailUri = $this->getThumbnailService($file)
68
-                    ->setOutputType(ThumbnailInterface::OUTPUT_URI)
69
-                    ->setConfiguration($this->configuration)
70
-                    ->create();
71
-
72
-                $this->resultSet[$file->getUid()] = [
73
-                    'fileUid' => $file->getUid(),
74
-                    'fileIdentifier' => $file->getIdentifier(),
75
-                    'thumbnailUri' => strpos($thumbnailUri, '_processed_') > 0 ? $thumbnailUri : '', // only returns the thumbnail uri if a processed file has been created.
76
-                ];
77
-
78
-                if ($this->isNewProcessedFile()) {
79
-                    $this->incrementNumberOfProcessedFiles();
80
-                    $this->newProcessedFileIdentifiers[$file->getUid()] = $this->lastInsertedProcessedFile;
81
-                }
82
-
83
-                $this->incrementNumberOfTraversedFiles();
84
-            } else {
85
-                $this->incrementNumberOfMissingFiles();
86
-            }
87
-        }
88
-    }
89
-
90
-    protected function isNewProcessedFile(): bool
91
-    {
92
-        $isNewProcessedFile = false;
93
-
94
-        $tableName = 'sys_file_processedfile';
95
-        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
96
-        $databaseConnection = $connectionPool->getConnectionForTable($tableName);
97
-        $lastInsertedId = (int)$databaseConnection->lastInsertId($tableName);
98
-
99
-        if ($lastInsertedId > 0 && $lastInsertedId !== $this->lastInsertedProcessedFile) {
100
-            $this->lastInsertedProcessedFile = $lastInsertedId;
101
-            $isNewProcessedFile = true;
102
-        }
103
-        return $isNewProcessedFile;
104
-    }
105
-
106
-    public function getNumberOfTraversedFiles(): int
107
-    {
108
-        return $this->numberOfTraversedFiles;
109
-    }
110
-
111
-    public function getNumberOfProcessedFiles(): int
112
-    {
113
-        return $this->numberOfProcessedFiles;
114
-    }
115
-
116
-    public function getTotalNumberOfFiles(): int
117
-    {
118
-        return $this->getDataService()
119
-            ->count(
120
-                'sys_file',
121
-                [
122
-                    'storage' => $this->storage->getUid()
123
-                ],
124
-                $this->limit,
125
-                $this->offset
126
-            );
127
-    }
128
-
129
-    /**
130
-     * @return array
131
-     */
132
-    public function getResultSet()
133
-    {
134
-        return $this->resultSet;
135
-    }
136
-
137
-    /**
138
-     * @return array
139
-     */
140
-    public function getNewProcessedFileIdentifiers()
141
-    {
142
-        return $this->newProcessedFileIdentifiers;
143
-    }
144
-
145
-    /**
146
-     * @return int
147
-     */
148
-    public function getNumberOfMissingFiles()
149
-    {
150
-        return $this->numberOfMissingFiles;
151
-    }
152
-
153
-    public function setStorage(ResourceStorage $storage): ThumbnailGenerator
154
-    {
155
-        $this->storage = $storage;
156
-        return $this;
157
-    }
158
-
159
-    /**
160
-     * @param Selection $selection
161
-     */
162
-    public function setSelection($selection): ThumbnailGenerator
163
-    {
164
-        $this->selection = $selection;
165
-        return $this;
166
-    }
167
-
168
-    public function setConfiguration(array $configuration): ThumbnailGenerator
169
-    {
170
-        $this->configuration = $configuration;
171
-        return $this;
172
-    }
173
-
174
-    protected function getThumbnailService(File $file): ThumbnailService
175
-    {
176
-        return GeneralUtility::makeInstance(ThumbnailService::class, $file);
177
-    }
178
-
179
-    protected function incrementNumberOfTraversedFiles()
180
-    {
181
-        $this->numberOfTraversedFiles++;
182
-    }
183
-
184
-    protected function incrementNumberOfMissingFiles()
185
-    {
186
-        $this->numberOfMissingFiles++;
187
-    }
188
-
189
-    protected function incrementNumberOfProcessedFiles()
190
-    {
191
-        $this->numberOfProcessedFiles++;
192
-    }
193
-
194
-    protected function getDataService(): DataService
195
-    {
196
-        return GeneralUtility::makeInstance(DataService::class);
197
-    }
198
-
199
-    protected function getResourceFactory(): ResourceFactory
200
-    {
201
-        return GeneralUtility::makeInstance(ResourceFactory::class);
202
-    }
25
+	protected int $numberOfTraversedFiles = 0;
26
+
27
+	protected int $numberOfProcessedFiles = 0;
28
+
29
+	protected int $numberOfMissingFiles = 0;
30
+
31
+	protected array $configuration = [];
32
+
33
+	protected ?ResourceStorage $storage = null;
34
+
35
+	protected ?Selection $selection = null;
36
+
37
+	protected array $resultSet = [];
38
+
39
+	protected array $newProcessedFileIdentifiers = [];
40
+
41
+	protected int $lastInsertedProcessedFile = 0;
42
+
43
+	protected int $limit = 0;
44
+
45
+	protected int $offset = 0;
46
+
47
+	public function generate(int $limit = 0, int $offset = 0): void
48
+	{
49
+		$this->limit = $limit;
50
+		$this->offset = $offset;
51
+
52
+		// Compute a possible limit and offset for the query.
53
+		$rows = $this->getDataService()
54
+			->getRecords(
55
+				'sys_file',
56
+				[
57
+					'storage' => $this->storage->getUid()
58
+				],
59
+				$limit,
60
+				$offset
61
+			);
62
+
63
+		foreach ($rows as $row) {
64
+			$file = $this->getResourceFactory()->getFileObject($row['uid'], $row);
65
+
66
+			if ($file->exists()) {
67
+				$thumbnailUri = $this->getThumbnailService($file)
68
+					->setOutputType(ThumbnailInterface::OUTPUT_URI)
69
+					->setConfiguration($this->configuration)
70
+					->create();
71
+
72
+				$this->resultSet[$file->getUid()] = [
73
+					'fileUid' => $file->getUid(),
74
+					'fileIdentifier' => $file->getIdentifier(),
75
+					'thumbnailUri' => strpos($thumbnailUri, '_processed_') > 0 ? $thumbnailUri : '', // only returns the thumbnail uri if a processed file has been created.
76
+				];
77
+
78
+				if ($this->isNewProcessedFile()) {
79
+					$this->incrementNumberOfProcessedFiles();
80
+					$this->newProcessedFileIdentifiers[$file->getUid()] = $this->lastInsertedProcessedFile;
81
+				}
82
+
83
+				$this->incrementNumberOfTraversedFiles();
84
+			} else {
85
+				$this->incrementNumberOfMissingFiles();
86
+			}
87
+		}
88
+	}
89
+
90
+	protected function isNewProcessedFile(): bool
91
+	{
92
+		$isNewProcessedFile = false;
93
+
94
+		$tableName = 'sys_file_processedfile';
95
+		$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
96
+		$databaseConnection = $connectionPool->getConnectionForTable($tableName);
97
+		$lastInsertedId = (int)$databaseConnection->lastInsertId($tableName);
98
+
99
+		if ($lastInsertedId > 0 && $lastInsertedId !== $this->lastInsertedProcessedFile) {
100
+			$this->lastInsertedProcessedFile = $lastInsertedId;
101
+			$isNewProcessedFile = true;
102
+		}
103
+		return $isNewProcessedFile;
104
+	}
105
+
106
+	public function getNumberOfTraversedFiles(): int
107
+	{
108
+		return $this->numberOfTraversedFiles;
109
+	}
110
+
111
+	public function getNumberOfProcessedFiles(): int
112
+	{
113
+		return $this->numberOfProcessedFiles;
114
+	}
115
+
116
+	public function getTotalNumberOfFiles(): int
117
+	{
118
+		return $this->getDataService()
119
+			->count(
120
+				'sys_file',
121
+				[
122
+					'storage' => $this->storage->getUid()
123
+				],
124
+				$this->limit,
125
+				$this->offset
126
+			);
127
+	}
128
+
129
+	/**
130
+	 * @return array
131
+	 */
132
+	public function getResultSet()
133
+	{
134
+		return $this->resultSet;
135
+	}
136
+
137
+	/**
138
+	 * @return array
139
+	 */
140
+	public function getNewProcessedFileIdentifiers()
141
+	{
142
+		return $this->newProcessedFileIdentifiers;
143
+	}
144
+
145
+	/**
146
+	 * @return int
147
+	 */
148
+	public function getNumberOfMissingFiles()
149
+	{
150
+		return $this->numberOfMissingFiles;
151
+	}
152
+
153
+	public function setStorage(ResourceStorage $storage): ThumbnailGenerator
154
+	{
155
+		$this->storage = $storage;
156
+		return $this;
157
+	}
158
+
159
+	/**
160
+	 * @param Selection $selection
161
+	 */
162
+	public function setSelection($selection): ThumbnailGenerator
163
+	{
164
+		$this->selection = $selection;
165
+		return $this;
166
+	}
167
+
168
+	public function setConfiguration(array $configuration): ThumbnailGenerator
169
+	{
170
+		$this->configuration = $configuration;
171
+		return $this;
172
+	}
173
+
174
+	protected function getThumbnailService(File $file): ThumbnailService
175
+	{
176
+		return GeneralUtility::makeInstance(ThumbnailService::class, $file);
177
+	}
178
+
179
+	protected function incrementNumberOfTraversedFiles()
180
+	{
181
+		$this->numberOfTraversedFiles++;
182
+	}
183
+
184
+	protected function incrementNumberOfMissingFiles()
185
+	{
186
+		$this->numberOfMissingFiles++;
187
+	}
188
+
189
+	protected function incrementNumberOfProcessedFiles()
190
+	{
191
+		$this->numberOfProcessedFiles++;
192
+	}
193
+
194
+	protected function getDataService(): DataService
195
+	{
196
+		return GeneralUtility::makeInstance(DataService::class);
197
+	}
198
+
199
+	protected function getResourceFactory(): ResourceFactory
200
+	{
201
+		return GeneralUtility::makeInstance(ResourceFactory::class);
202
+	}
203 203
 }
Please login to merge, or discard this patch.
Classes/Thumbnail/ApplicationThumbnailProcessor.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -18,126 +18,126 @@
 block discarded – undo
18 18
  */
19 19
 class ApplicationThumbnailProcessor extends AbstractThumbnailProcessor
20 20
 {
21
-    /**
22
-     * Render a thumbnail of a resource of type application.
23
-     *
24
-     */
25
-    public function create(): string
26
-    {
27
-        $steps = $this->getRenderingSteps();
28
-
29
-        $result = '';
30
-        while ($step = array_shift($steps)) {
31
-            $result = $this->$step($result);
32
-        }
33
-
34
-        return $result;
35
-    }
36
-
37
-    /**
38
-     * Render the URI of the thumbnail.
39
-     *
40
-     */
41
-    public function renderUri(): string
42
-    {
43
-        if ($this->isThumbnailPossible($this->getFile()->getExtension())) {
44
-            $this->processedFile = $this->getFile()->process($this->getProcessingType(), $this->getConfiguration());
45
-            $uri = $this->processedFile->getPublicUrl(true);
46
-
47
-            // Update time stamp of processed image at this stage. This is needed for the browser to get new version of the thumbnail.
48
-            if ($this->processedFile->getProperty('originalfilesha1') !== $this->getFile()->getProperty('sha1')) {
49
-                $this->processedFile->updateProperties(array('tstamp' => $this->getFile()->getProperty('tstamp')));
50
-            }
51
-        } else {
52
-            $uri = $this->getIcon($this->getFile()->getExtension());
53
-        }
54
-        return $this->prefixUri($uri);
55
-    }
56
-
57
-    /**
58
-     * Render the tag image which is the main one for a thumbnail.
59
-     *
60
-     * @param string $result
61
-     */
62
-    public function renderTagImage($result): string
63
-    {
64
-        // Variable $result corresponds to an URL in this case.
65
-        // Analyse the URL and compute the adequate separator between arguments.
66
-        $parameterSeparator = strpos($result, '?') === false ? '?' : '&';
67
-
68
-        return sprintf(
69
-            '<img src="%s%s" title="%s" alt="%s" %s/>',
70
-            $result,
71
-            $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getTimeStamp() : '',
72
-            $this->getTitle(),
73
-            $this->getTitle(),
74
-            $this->renderAttributes()
75
-        );
76
-    }
77
-
78
-    /**
79
-     * Compute and return the time stamp.
80
-     *
81
-     * @return int
82
-     */
83
-    protected function getTimeStamp()
84
-    {
85
-        $result = $this->getFile()->getProperty('tstamp');
86
-        if ($this->processedFile) {
87
-            $result = $this->processedFile->getProperty('tstamp');
88
-        }
89
-        return $result;
90
-    }
91
-
92
-    /**
93
-     * Compute and return the title of the file.
94
-     */
95
-    protected function getTitle(): string
96
-    {
97
-        $result = $this->getFile()->getProperty('title');
98
-        if (empty($result)) {
99
-            $result = $this->getFile()->getName();
100
-        }
101
-        return htmlspecialchars($result);
102
-    }
103
-
104
-    /**
105
-     * Render a wrapping anchor around the thumbnail.
106
-     *
107
-     * @param string $result
108
-     */
109
-    public function renderTagAnchor($result): string
110
-    {
111
-        $uri = $this->thumbnailService->getAnchorUri();
112
-        if (!$uri) {
113
-            $uri = $this->getUri();
114
-        }
115
-
116
-        return sprintf(
117
-            '<a href="%s" target="_blank" data-uid="%s">%s</a>',
118
-            $uri,
119
-            $this->getFile()->getUid(),
120
-            $result
121
-        );
122
-    }
123
-
124
-    protected function getUri(): string
125
-    {
126
-        $urlParameters = [
127
-            MediaModule::getParameterPrefix() => [
128
-                'controller' => 'Asset',
129
-                'action' => 'download',
130
-                'file' => $this->getFile()->getUid(),
131
-            ],
132
-        ];
133
-        return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters);
134
-    }
135
-
136
-    public function getProcessingType(): string
137
-    {
138
-        if (!$this->thumbnailService->getProcessingType()) {
139
-            return ProcessedFile::CONTEXT_IMAGECROPSCALEMASK;
140
-        }
141
-        return $this->thumbnailService->getProcessingType();
142
-    }
21
+	/**
22
+	 * Render a thumbnail of a resource of type application.
23
+	 *
24
+	 */
25
+	public function create(): string
26
+	{
27
+		$steps = $this->getRenderingSteps();
28
+
29
+		$result = '';
30
+		while ($step = array_shift($steps)) {
31
+			$result = $this->$step($result);
32
+		}
33
+
34
+		return $result;
35
+	}
36
+
37
+	/**
38
+	 * Render the URI of the thumbnail.
39
+	 *
40
+	 */
41
+	public function renderUri(): string
42
+	{
43
+		if ($this->isThumbnailPossible($this->getFile()->getExtension())) {
44
+			$this->processedFile = $this->getFile()->process($this->getProcessingType(), $this->getConfiguration());
45
+			$uri = $this->processedFile->getPublicUrl(true);
46
+
47
+			// Update time stamp of processed image at this stage. This is needed for the browser to get new version of the thumbnail.
48
+			if ($this->processedFile->getProperty('originalfilesha1') !== $this->getFile()->getProperty('sha1')) {
49
+				$this->processedFile->updateProperties(array('tstamp' => $this->getFile()->getProperty('tstamp')));
50
+			}
51
+		} else {
52
+			$uri = $this->getIcon($this->getFile()->getExtension());
53
+		}
54
+		return $this->prefixUri($uri);
55
+	}
56
+
57
+	/**
58
+	 * Render the tag image which is the main one for a thumbnail.
59
+	 *
60
+	 * @param string $result
61
+	 */
62
+	public function renderTagImage($result): string
63
+	{
64
+		// Variable $result corresponds to an URL in this case.
65
+		// Analyse the URL and compute the adequate separator between arguments.
66
+		$parameterSeparator = strpos($result, '?') === false ? '?' : '&';
67
+
68
+		return sprintf(
69
+			'<img src="%s%s" title="%s" alt="%s" %s/>',
70
+			$result,
71
+			$this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getTimeStamp() : '',
72
+			$this->getTitle(),
73
+			$this->getTitle(),
74
+			$this->renderAttributes()
75
+		);
76
+	}
77
+
78
+	/**
79
+	 * Compute and return the time stamp.
80
+	 *
81
+	 * @return int
82
+	 */
83
+	protected function getTimeStamp()
84
+	{
85
+		$result = $this->getFile()->getProperty('tstamp');
86
+		if ($this->processedFile) {
87
+			$result = $this->processedFile->getProperty('tstamp');
88
+		}
89
+		return $result;
90
+	}
91
+
92
+	/**
93
+	 * Compute and return the title of the file.
94
+	 */
95
+	protected function getTitle(): string
96
+	{
97
+		$result = $this->getFile()->getProperty('title');
98
+		if (empty($result)) {
99
+			$result = $this->getFile()->getName();
100
+		}
101
+		return htmlspecialchars($result);
102
+	}
103
+
104
+	/**
105
+	 * Render a wrapping anchor around the thumbnail.
106
+	 *
107
+	 * @param string $result
108
+	 */
109
+	public function renderTagAnchor($result): string
110
+	{
111
+		$uri = $this->thumbnailService->getAnchorUri();
112
+		if (!$uri) {
113
+			$uri = $this->getUri();
114
+		}
115
+
116
+		return sprintf(
117
+			'<a href="%s" target="_blank" data-uid="%s">%s</a>',
118
+			$uri,
119
+			$this->getFile()->getUid(),
120
+			$result
121
+		);
122
+	}
123
+
124
+	protected function getUri(): string
125
+	{
126
+		$urlParameters = [
127
+			MediaModule::getParameterPrefix() => [
128
+				'controller' => 'Asset',
129
+				'action' => 'download',
130
+				'file' => $this->getFile()->getUid(),
131
+			],
132
+		];
133
+		return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters);
134
+	}
135
+
136
+	public function getProcessingType(): string
137
+	{
138
+		if (!$this->thumbnailService->getProcessingType()) {
139
+			return ProcessedFile::CONTEXT_IMAGECROPSCALEMASK;
140
+		}
141
+		return $this->thumbnailService->getProcessingType();
142
+	}
143 143
 }
Please login to merge, or discard this patch.
Classes/Thumbnail/ThumbnailConfiguration.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -15,95 +15,95 @@
 block discarded – undo
15 15
  */
16 16
 class ThumbnailConfiguration
17 17
 {
18
-    /**
19
-     * @var int
20
-     */
21
-    protected $width = 0;
18
+	/**
19
+	 * @var int
20
+	 */
21
+	protected $width = 0;
22 22
 
23
-    /**
24
-     * @var int
25
-     */
26
-    protected $height = 0;
23
+	/**
24
+	 * @var int
25
+	 */
26
+	protected $height = 0;
27 27
 
28
-    /**
29
-     * @var string
30
-     */
31
-    protected $style = '';
28
+	/**
29
+	 * @var string
30
+	 */
31
+	protected $style = '';
32 32
 
33
-    /**
34
-     * @var string
35
-     */
36
-    protected $className = '';
33
+	/**
34
+	 * @var string
35
+	 */
36
+	protected $className = '';
37 37
 
38
-    /**
39
-     * @return int
40
-     */
41
-    public function getWidth()
42
-    {
43
-        return $this->width;
44
-    }
38
+	/**
39
+	 * @return int
40
+	 */
41
+	public function getWidth()
42
+	{
43
+		return $this->width;
44
+	}
45 45
 
46
-    /**
47
-     * @param int $width
48
-     * @return $this
49
-     */
50
-    public function setWidth($width)
51
-    {
52
-        $this->width = $width;
53
-        return $this;
54
-    }
46
+	/**
47
+	 * @param int $width
48
+	 * @return $this
49
+	 */
50
+	public function setWidth($width)
51
+	{
52
+		$this->width = $width;
53
+		return $this;
54
+	}
55 55
 
56
-    /**
57
-     * @return int
58
-     */
59
-    public function getHeight()
60
-    {
61
-        return $this->height;
62
-    }
56
+	/**
57
+	 * @return int
58
+	 */
59
+	public function getHeight()
60
+	{
61
+		return $this->height;
62
+	}
63 63
 
64
-    /**
65
-     * @param int $height
66
-     * @return $this
67
-     */
68
-    public function setHeight($height)
69
-    {
70
-        $this->height = $height;
71
-        return $this;
72
-    }
64
+	/**
65
+	 * @param int $height
66
+	 * @return $this
67
+	 */
68
+	public function setHeight($height)
69
+	{
70
+		$this->height = $height;
71
+		return $this;
72
+	}
73 73
 
74
-    /**
75
-     * @return string
76
-     */
77
-    public function getStyle()
78
-    {
79
-        return $this->style;
80
-    }
74
+	/**
75
+	 * @return string
76
+	 */
77
+	public function getStyle()
78
+	{
79
+		return $this->style;
80
+	}
81 81
 
82
-    /**
83
-     * @param string $style
84
-     * @return $this
85
-     */
86
-    public function setStyle($style)
87
-    {
88
-        $this->style = $style;
89
-        return $this;
90
-    }
82
+	/**
83
+	 * @param string $style
84
+	 * @return $this
85
+	 */
86
+	public function setStyle($style)
87
+	{
88
+		$this->style = $style;
89
+		return $this;
90
+	}
91 91
 
92
-    /**
93
-     * @return string
94
-     */
95
-    public function getClassName()
96
-    {
97
-        return $this->className;
98
-    }
92
+	/**
93
+	 * @return string
94
+	 */
95
+	public function getClassName()
96
+	{
97
+		return $this->className;
98
+	}
99 99
 
100
-    /**
101
-     * @param string $className
102
-     * @return $this
103
-     */
104
-    public function setClassName($className)
105
-    {
106
-        $this->className = $className;
107
-        return $this;
108
-    }
100
+	/**
101
+	 * @param string $className
102
+	 * @return $this
103
+	 */
104
+	public function setClassName($className)
105
+	{
106
+		$this->className = $className;
107
+		return $this;
108
+	}
109 109
 }
Please login to merge, or discard this patch.