Issues (263)

lib/Service/Base64Encode.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Nextcloud - Gallery
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Olivier Paroz <[email protected]>
9
 *
10
 * @copyright Olivier Paroz 2017
11
 */
12
13
namespace OCA\Gallery\Service;
14
15
/**
16
 * Base64 encoding utility method
17
 *
18
 * @package OCA\Gallery\Service
19
 */
20
trait Base64Encode {
21
22
	/**
23
	 * Returns base64 encoded data of a preview
24
	 *
25
	 * Using base64_encode for files which are downloaded
26
	 * (cached Thumbnails, SVG, GIFs) and using __toStrings
27
	 * for the previews which are instances of \OC_Image
28
	 *
29
	 * @param \OC_Image|string $previewData
30
	 *
31
	 * @return string
32
	 */
33
	protected function encode($previewData) {
34
		if ($previewData instanceof \OC_Image) {
0 ignored issues
show
The type OC_Image was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
35
			$previewData = (string)$previewData;
36
		} else {
37
			$previewData = base64_encode($previewData);
38
		}
39
40
		return $previewData;
41
	}
42
}
43