|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
| 4 | +/** |
| 5 | + * Pimcore |
| 6 | + * |
| 7 | + * This source file is available under two different licenses: |
| 8 | + * - GNU General Public License version 3 (GPLv3) |
| 9 | + * - Pimcore Commercial License (PCL) |
| 10 | + * Full copyright and license information is available in |
| 11 | + * LICENSE.md which is distributed with this source code. |
| 12 | + * |
| 13 | + * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) |
| 14 | + * @license http://www.pimcore.org/license GPLv3 and PCL |
| 15 | + */ |
| 16 | + |
| 17 | +namespace Pimcore\Bundle\StaticResolverBundle\Contract\Models\Asset; |
| 18 | + |
| 19 | +use Exception; |
| 20 | +use League\Flysystem\FilesystemException; |
| 21 | +use Pimcore\Model\Asset; |
| 22 | +use Pimcore\Model\Asset\Image\ThumbnailInterface; |
| 23 | +use Pimcore\Model\Asset\Service; |
| 24 | +use Pimcore\Model\DataObject; |
| 25 | +use Pimcore\Model\DataObject\AbstractObject; |
| 26 | +use Pimcore\Model\Document; |
| 27 | +use Pimcore\Model\Element\ElementInterface; |
| 28 | +use Symfony\Component\HttpFoundation\StreamedResponse; |
| 29 | + |
| 30 | +class AssetServiceResolverContract implements AssetServiceResolverContractInterface |
| 31 | +{ |
| 32 | + public function pathExists(string $path, ?string $type = null): bool |
| 33 | + { |
| 34 | + return Service::pathExists($path, $type); |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * @throws Exception |
| 39 | + */ |
| 40 | + public function createFolderByPath( |
| 41 | + string $path, |
| 42 | + array $options = [] |
| 43 | + ): Asset\Folder|DataObject\Folder|Document\Folder|null { |
| 44 | + return Service::createFolderByPath($path, $options); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @throws Exception |
| 49 | + */ |
| 50 | + public function getUniqueKey(ElementInterface $element, int $nr = 0): string |
| 51 | + { |
| 52 | + return Service::getUniqueKey($element, $nr); |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @throws Exception |
| 57 | + */ |
| 58 | + public function getImageThumbnailByArrayConfig( |
| 59 | + array $config |
| 60 | + ): null|ThumbnailInterface|Asset\Video\ImageThumbnailInterface|Asset\Document\ImageThumbnailInterface|array { |
| 61 | + return Service::getImageThumbnailByArrayConfig($config); |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * @throws FilesystemException |
| 66 | + */ |
| 67 | + public function getStreamedResponseFromImageThumbnail( |
| 68 | + ThumbnailInterface|Asset\Video\ImageThumbnailInterface|Asset\Document\ImageThumbnailInterface|array $thumbnail, |
| 69 | + array $config |
| 70 | + ): ?StreamedResponse { |
| 71 | + return Service::getStreamedResponseFromImageThumbnail($thumbnail, $config); |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * @throws Exception |
| 76 | + */ |
| 77 | + public function getStreamedResponseByUri(string $uri): ?StreamedResponse |
| 78 | + { |
| 79 | + return Service::getStreamedResponseByUri($uri); |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * @throws Exception |
| 84 | + */ |
| 85 | + public function extractThumbnailInfoFromUri(string $uri): array |
| 86 | + { |
| 87 | + return Service::extractThumbnailInfoFromUri($uri); |
| 88 | + } |
| 89 | + |
| 90 | + public function doHideUnpublished(?ElementInterface $element): bool |
| 91 | + { |
| 92 | + return Service::doHideUnpublished($element); |
| 93 | + } |
| 94 | + |
| 95 | + public function getElementByPath(string $type, string $path): ?ElementInterface |
| 96 | + { |
| 97 | + return Service::getElementByPath($type, $path); |
| 98 | + } |
| 99 | + |
| 100 | + public function getSafeCopyName(string $sourceKey, ElementInterface $target): string |
| 101 | + { |
| 102 | + return Service::getSafeCopyName($sourceKey, $target); |
| 103 | + } |
| 104 | + |
| 105 | + public function getElementById(string $type, int|string $id, array $params = []): Asset|Document|AbstractObject|null |
| 106 | + { |
| 107 | + return Service::getElementById($type, $id, $params); |
| 108 | + } |
| 109 | + |
| 110 | + public function getElementType(ElementInterface $element): ?string |
| 111 | + { |
| 112 | + return Service::getElementType($element); |
| 113 | + } |
| 114 | + |
| 115 | + public function getValidKey(string $key, string $type): string |
| 116 | + { |
| 117 | + return Service::getValidKey($key, $type); |
| 118 | + } |
| 119 | + |
| 120 | + public function isValidKey(string $key, string $type): bool |
| 121 | + { |
| 122 | + return Service::isValidKey($key, $type); |
| 123 | + } |
| 124 | + |
| 125 | + public function isValidPath(string $path, string $type): bool |
| 126 | + { |
| 127 | + return Service::isValidPath($path, $type); |
| 128 | + } |
| 129 | + |
| 130 | + public function cloneMe(ElementInterface $element): ElementInterface |
| 131 | + { |
| 132 | + return Service::cloneMe($element); |
| 133 | + } |
| 134 | + |
| 135 | + public function cloneProperties(mixed $properties): mixed |
| 136 | + { |
| 137 | + return Service::cloneProperties($properties); |
| 138 | + } |
| 139 | + |
| 140 | + public function getElementFromSession( |
| 141 | + string $type, |
| 142 | + int $elementId, |
| 143 | + string $sessionId, |
| 144 | + ?string $postfix = '' |
| 145 | + ): Asset|Document|AbstractObject|null { |
| 146 | + return Service::getElementFromSession($type, $elementId, $sessionId, $postfix); |
| 147 | + } |
| 148 | + |
| 149 | + public function locateDaoClass(string $modelClass): ?string |
| 150 | + { |
| 151 | + return Service::locateDaoClass($modelClass); |
| 152 | + } |
| 153 | +} |
0 commit comments