| Total Complexity | 68 |
| Total Lines | 526 |
| Duplicated Lines | 0 % |
| Changes | 13 | ||
| Bugs | 0 | Features | 0 |
Complex classes like Standard often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Standard, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 22 | class Standard |
||
| 23 | extends Base |
||
| 24 | implements \Aimeos\MShop\Media\Manager\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface |
||
| 25 | { |
||
| 26 | use \Aimeos\MShop\Common\Manager\PropertyRef\Traits; |
||
| 27 | use \Aimeos\MShop\Common\Manager\ListsRef\Traits; |
||
| 28 | use \Aimeos\MShop\Upload; |
||
| 29 | use Preview; |
||
| 30 | |||
| 31 | |||
| 32 | /** |
||
| 33 | * Copies the media item and the referenced files |
||
| 34 | * |
||
| 35 | * @param \Aimeos\MShop\Media\Item\Iface $item Media item whose files should be copied |
||
| 36 | * @return \Aimeos\MShop\Media\Item\Iface Copied media item with new files |
||
| 37 | */ |
||
| 38 | public function copy( \Aimeos\MShop\Media\Item\Iface $item ) : \Aimeos\MShop\Media\Item\Iface |
||
| 39 | { |
||
| 40 | $item = ( clone $item )->setId( null ); |
||
| 41 | |||
| 42 | $path = $item->getUrl(); |
||
| 43 | $mime = $item->getMimeType(); |
||
| 44 | $domain = $item->getDomain(); |
||
| 45 | $previews = $item->getPreviews(); |
||
| 46 | $fsname = $item->getFileSystem(); |
||
| 47 | $fs = $this->context()->fs( $fsname ); |
||
| 48 | |||
| 49 | if( $fs->has( $path ) ) |
||
| 50 | { |
||
| 51 | $newPath = $this->path( substr( basename( $path ), 9 ), $mime, $domain ); |
||
| 52 | $fs->copy( $path, $newPath ); |
||
| 53 | $item->setUrl( $newPath ); |
||
| 54 | } |
||
| 55 | |||
| 56 | if( empty( $previews ) ) { |
||
| 57 | return $this->scale( $item, true ); |
||
| 58 | } |
||
| 59 | |||
| 60 | foreach( $previews as $size => $preview ) |
||
| 61 | { |
||
| 62 | if( $fsname !== 'fs-mimeicon' && $fs->has( $preview ) ) |
||
| 63 | { |
||
| 64 | $newPath = $this->path( substr( basename( $preview ), 9 ), $mime, $domain ); |
||
| 65 | $fs->copy( $preview, $newPath ); |
||
| 66 | $previews[$size] = $newPath; |
||
| 67 | } |
||
| 68 | } |
||
| 69 | |||
| 70 | return $item->setPreviews( $previews ); |
||
| 71 | } |
||
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * Creates a new empty item instance |
||
| 76 | * |
||
| 77 | * @param array $values Values the item should be initialized with |
||
| 78 | * @return \Aimeos\MShop\Media\Item\Iface New media item object |
||
| 79 | */ |
||
| 80 | public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface |
||
| 81 | { |
||
| 82 | $locale = $this->context()->locale(); |
||
| 83 | |||
| 84 | $values['.languageid'] = $locale->getLanguageId(); |
||
| 85 | $values['media.siteid'] = $values['media.siteid'] ?? $locale->getSiteId(); |
||
| 86 | |||
| 87 | return new \Aimeos\MShop\Media\Item\Standard( 'media.', $values ); |
||
| 88 | } |
||
| 89 | |||
| 90 | |||
| 91 | /** |
||
| 92 | * Removes multiple items. |
||
| 93 | * |
||
| 94 | * @param \Aimeos\MShop\Common\Item\Iface[]|string[] $items List of item objects or IDs of the items |
||
| 95 | * @return \Aimeos\MShop\Media\Manager\Iface Manager object for chaining method calls |
||
| 96 | */ |
||
| 97 | public function delete( $items ) : \Aimeos\MShop\Common\Manager\Iface |
||
| 98 | { |
||
| 99 | foreach( map( $items ) as $item ) |
||
| 100 | { |
||
| 101 | if( $item instanceof \Aimeos\MShop\Media\Item\Iface && $item->getFileSystem() === 'fs-media' ) |
||
| 102 | { |
||
| 103 | try |
||
| 104 | { |
||
| 105 | $this->deletePreviews( $item, $item->getPreviews() ); |
||
| 106 | $this->deleteFile( $item->getUrl(), 'fs-media' ); |
||
| 107 | } |
||
| 108 | catch( \Exception $e ) |
||
| 109 | { |
||
| 110 | $this->context()->logger()->warning( $e->getMessage() ); |
||
| 111 | } |
||
| 112 | } |
||
| 113 | } |
||
| 114 | |||
| 115 | return parent::delete( $items ); |
||
| 116 | } |
||
| 117 | |||
| 118 | |||
| 119 | /** |
||
| 120 | * Creates a filter object. |
||
| 121 | * |
||
| 122 | * @param bool|null $default Add default criteria or NULL for relaxed default criteria |
||
| 123 | * @param bool $site TRUE for adding site criteria to limit items by the site of related items |
||
| 124 | * @return \Aimeos\Base\Criteria\Iface Returns the filter object |
||
| 125 | */ |
||
| 126 | public function filter( ?bool $default = false, bool $site = false ) : \Aimeos\Base\Criteria\Iface |
||
| 127 | { |
||
| 128 | $filter = $this->filterBase( 'media', $default ); |
||
| 129 | |||
| 130 | if( $default !== false ) |
||
| 131 | { |
||
| 132 | if( $langid = $this->context()->locale()->getLanguageId() ) |
||
| 133 | { |
||
| 134 | $filter->add( $filter->or( [ |
||
| 135 | $filter->compare( '==', 'media.languageid', $langid ), |
||
| 136 | $filter->compare( '==', 'media.languageid', null ), |
||
| 137 | ] ) ); |
||
| 138 | } |
||
| 139 | } |
||
| 140 | |||
| 141 | return $filter; |
||
| 142 | } |
||
| 143 | |||
| 144 | |||
| 145 | /** |
||
| 146 | * Returns the additional column/search definitions |
||
| 147 | * |
||
| 148 | * @return array Associative list of column names as keys and items implementing \Aimeos\Base\Criteria\Attribute\Iface |
||
| 149 | */ |
||
| 150 | public function getSaveAttributes() : array |
||
| 151 | { |
||
| 152 | return $this->createAttributes( [ |
||
| 153 | 'media.type' => [ |
||
| 154 | 'label' => 'Type', |
||
| 155 | 'internalcode' => 'type', |
||
| 156 | ], |
||
| 157 | 'media.label' => [ |
||
| 158 | 'label' => 'Label', |
||
| 159 | 'internalcode' => 'label', |
||
| 160 | ], |
||
| 161 | 'media.domain' => [ |
||
| 162 | 'label' => 'Domain', |
||
| 163 | 'internalcode' => 'domain', |
||
| 164 | ], |
||
| 165 | 'media.languageid' => [ |
||
| 166 | 'label' => 'Language code', |
||
| 167 | 'internalcode' => 'langid', |
||
| 168 | ], |
||
| 169 | 'media.mimetype' => [ |
||
| 170 | 'label' => 'Mime type', |
||
| 171 | 'internalcode' => 'mimetype', |
||
| 172 | ], |
||
| 173 | 'media.url' => [ |
||
| 174 | 'label' => 'URL', |
||
| 175 | 'internalcode' => 'link', |
||
| 176 | ], |
||
| 177 | 'media.previews' => [ |
||
| 178 | 'label' => 'Preview URLs as JSON encoded string', |
||
| 179 | 'internalcode' => 'preview', |
||
| 180 | 'type' => 'json', |
||
| 181 | ], |
||
| 182 | 'media.filesystem' => [ |
||
| 183 | 'label' => 'File sytem name', |
||
| 184 | 'internalcode' => 'fsname', |
||
| 185 | ], |
||
| 186 | 'media.status' => [ |
||
| 187 | 'label' => 'Status', |
||
| 188 | 'internalcode' => 'status', |
||
| 189 | 'type' => 'int', |
||
| 190 | ], |
||
| 191 | ] ); |
||
| 192 | } |
||
| 193 | |||
| 194 | |||
| 195 | /** |
||
| 196 | * Returns the attributes that can be used for searching. |
||
| 197 | * |
||
| 198 | * @param bool $withsub Return also attributes of sub-managers if true |
||
| 199 | * @return \Aimeos\Base\Criteria\Attribute\Iface[] List of search attribute items |
||
| 200 | */ |
||
| 201 | public function getSearchAttributes( bool $withsub = true ) : array |
||
| 202 | { |
||
| 203 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
||
| 204 | $level = $this->context()->config()->get( 'mshop/media/manager/sitemode', $level ); |
||
| 205 | |||
| 206 | return array_replace( parent::getSearchAttributes( $withsub ), $this->createAttributes( [ |
||
| 207 | 'media.preview' => [ |
||
| 208 | 'label' => 'Preview URLs as JSON encoded string', |
||
| 209 | 'internalcode' => 'preview', |
||
| 210 | 'type' => 'json', |
||
| 211 | ], |
||
| 212 | 'media:has' => array( |
||
| 213 | 'code' => 'media:has()', |
||
| 214 | 'internalcode' => ':site AND :key AND mmedli."id"', |
||
| 215 | 'internaldeps' => ['LEFT JOIN "mshop_media_list" AS mmedli ON ( mmedli."parentid" = mmed."id" )'], |
||
| 216 | 'label' => 'Media has list item, parameter(<domain>[,<list type>[,<reference ID>)]]', |
||
| 217 | 'type' => 'null', |
||
| 218 | 'public' => false, |
||
| 219 | 'function' => function( &$source, array $params ) use ( $level ) { |
||
| 220 | $keys = []; |
||
| 221 | |||
| 222 | foreach( (array) ( $params[1] ?? '' ) as $type ) { |
||
| 223 | foreach( (array) ( $params[2] ?? '' ) as $id ) { |
||
| 224 | $keys[] = $params[0] . '|' . ( $type ? $type . '|' : '' ) . $id; |
||
| 225 | } |
||
| 226 | } |
||
| 227 | |||
| 228 | $sitestr = $this->siteString( 'mmedli."siteid"', $level ); |
||
| 229 | $keystr = $this->toExpression( 'mmedli."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' ); |
||
| 230 | $source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source ); |
||
| 231 | |||
| 232 | return $params; |
||
| 233 | } |
||
| 234 | ), |
||
| 235 | 'media:prop' => array( |
||
| 236 | 'code' => 'media:prop()', |
||
| 237 | 'internalcode' => ':site AND :key AND mmedpr."id"', |
||
| 238 | 'internaldeps' => ['LEFT JOIN "mshop_media_property" AS mmedpr ON ( mmedpr."parentid" = mmed."id" )'], |
||
| 239 | 'label' => 'Media has property item, parameter(<property type>[,<language code>[,<property value>]])', |
||
| 240 | 'type' => 'null', |
||
| 241 | 'public' => false, |
||
| 242 | 'function' => function( &$source, array $params ) use ( $level ) { |
||
| 243 | $keys = []; |
||
| 244 | $langs = array_key_exists( 1, $params ) ? ( $params[1] ?? 'null' ) : ''; |
||
| 245 | |||
| 246 | foreach( (array) $langs as $lang ) { |
||
| 247 | foreach( (array) ( $params[2] ?? '' ) as $val ) { |
||
| 248 | $keys[] = substr( $params[0] . '|' . ( $lang === null ? 'null|' : ( $lang ? $lang . '|' : '' ) ) . $val, 0, 255 ); |
||
| 249 | } |
||
| 250 | } |
||
| 251 | |||
| 252 | $sitestr = $this->siteString( 'mmedpr."siteid"', $level ); |
||
| 253 | $keystr = $this->toExpression( 'mmedpr."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' ); |
||
| 254 | $source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source ); |
||
| 255 | |||
| 256 | return $params; |
||
| 257 | } |
||
| 258 | ), |
||
| 259 | ] ) ); |
||
| 260 | } |
||
| 261 | |||
| 262 | |||
| 263 | /** |
||
| 264 | * Fetches the rows from the database statement and returns the list of items. |
||
| 265 | * |
||
| 266 | * @param \Aimeos\Base\DB\Result\Iface $stmt Database statement object |
||
| 267 | * @param array $ref List of domains whose items should be fetched too |
||
| 268 | * @param string $prefix Prefix for the property names |
||
| 269 | * @param array $attrs List of attributes that should be decoded |
||
| 270 | * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface |
||
| 271 | */ |
||
| 272 | protected function fetch( \Aimeos\Base\DB\Result\Iface $results, array $ref, string $prefix = '', array $attrs = [] ) : \Aimeos\Map |
||
| 273 | { |
||
| 274 | $map = $items = $parentIds = $propItems = []; |
||
| 275 | |||
| 276 | while( $row = $results->fetch() ) |
||
| 277 | { |
||
| 278 | foreach( $attrs as $code => $attr ) { |
||
| 279 | $row[$code] = json_decode( $row[$code], true ); |
||
| 280 | } |
||
| 281 | |||
| 282 | $map[$row['media.id']] = $row; |
||
| 283 | $parentIds[] = $row['media.id']; |
||
| 284 | } |
||
| 285 | |||
| 286 | if( $this->hasRef( $ref, 'media/property' ) ) |
||
| 287 | { |
||
| 288 | $name = 'media/property'; |
||
| 289 | $propTypes = isset( $ref[$name] ) && is_array( $ref[$name] ) ? $ref[$name] : null; |
||
| 290 | |||
| 291 | $propItems = $this->getPropertyItems( $parentIds, 'media', $propTypes ); |
||
| 292 | } |
||
| 293 | |||
| 294 | $listItems = map( $this->getListItems( $parentIds, $ref, 'media' ) )->groupBy( 'media.lists.parentid' ); |
||
| 295 | |||
| 296 | foreach( $map as $id => $row ) |
||
| 297 | { |
||
| 298 | $row['.listitems'] = $listItems[$id] ?? []; |
||
| 299 | $row['.propitems'] = $propItems[$id] ?? []; |
||
| 300 | |||
| 301 | if( $item = $this->applyFilter( $this->create( $row ) ) ) { |
||
| 302 | $items[$id] = $item; |
||
| 303 | } |
||
| 304 | } |
||
| 305 | |||
| 306 | return map( $items ); |
||
| 307 | } |
||
| 308 | |||
| 309 | |||
| 310 | /** |
||
| 311 | * Returns the prefix for the item properties and search keys. |
||
| 312 | * |
||
| 313 | * @return string Prefix for the item properties and search keys |
||
| 314 | */ |
||
| 315 | protected function prefix() : string |
||
| 316 | { |
||
| 317 | return 'media.'; |
||
| 318 | } |
||
| 319 | |||
| 320 | |||
| 321 | /** |
||
| 322 | * Saves the dependent items of the item |
||
| 323 | * |
||
| 324 | * @param \Aimeos\MShop\Common\Item\Iface $item Item object |
||
| 325 | * @param bool $fetch True if the new ID should be returned in the item |
||
| 326 | * @return \Aimeos\MShop\Common\Item\Iface Updated item |
||
| 327 | */ |
||
| 328 | protected function saveDeps( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Common\Item\Iface |
||
| 329 | { |
||
| 330 | $item = $this->savePropertyItems( $item, 'media', $fetch ); |
||
| 331 | return $this->saveListItems( $item, 'media', $fetch ); |
||
| 332 | } |
||
| 333 | |||
| 334 | |||
| 335 | /** |
||
| 336 | * Rescales the original file to preview files referenced by the media item |
||
| 337 | * |
||
| 338 | * The height/width configuration for scaling |
||
| 339 | * - mshop/media/<files|preview>/maxheight |
||
| 340 | * - mshop/media/<files|preview>/maxwidth |
||
| 341 | * - mshop/media/<files|preview>/force-size |
||
| 342 | * |
||
| 343 | * @param \Aimeos\MShop\Media\Item\Iface $item Media item whose files should be scaled |
||
| 344 | * @param bool $force True to enforce creating new preview images |
||
| 345 | * @return \Aimeos\MShop\Media\Item\Iface Rescaled media item |
||
| 346 | */ |
||
| 347 | public function scale( \Aimeos\MShop\Media\Item\Iface $item, bool $force = false ) : \Aimeos\MShop\Media\Item\Iface |
||
| 348 | { |
||
| 349 | $mime = $item->getMimeType(); |
||
| 350 | |||
| 351 | if( empty( $url = $item->getUrl() ) |
||
| 352 | || $item->getFileSystem() === 'fs-mimeicon' |
||
| 353 | || strncmp( 'data:', $url, 5 ) === 0 |
||
| 354 | || strncmp( 'image/svg', $mime, 9 ) === 0 |
||
| 355 | || strncmp( 'image/', $mime, 6 ) !== 0 |
||
| 356 | ) { |
||
| 357 | return $item; |
||
| 358 | } |
||
| 359 | |||
| 360 | $fs = $this->context()->fs( $item->getFileSystem() ); |
||
| 361 | $is = ( $fs instanceof \Aimeos\Base\Filesystem\MetaIface ? true : false ); |
||
| 362 | |||
| 363 | if( !$force |
||
| 364 | && !empty( $item->getPreviews() ) |
||
| 365 | && preg_match( '#^[a-zA-Z]{2,6}://#', $url ) !== 1 |
||
| 366 | && ( $is && date( 'Y-m-d H:i:s', $fs->time( $url ) ) < $item->getTimeModified() || $fs->has( $url ) ) |
||
| 367 | ) { |
||
| 368 | return $item; |
||
| 369 | } |
||
| 370 | |||
| 371 | $domain = $item->getDomain() ?: '-'; |
||
| 372 | $sizes = $this->sizes( $domain, $item->getType() ); |
||
| 373 | $image = $this->image( $url ); |
||
| 374 | $quality = $this->quality(); |
||
| 375 | $old = $item->getPreviews(); |
||
| 376 | $previews = []; |
||
| 377 | |||
| 378 | foreach( $this->createPreviews( $image, $sizes ) as $width => $image ) |
||
| 379 | { |
||
| 380 | $path = $old[$width] ?? $this->path( $url, 'image/webp', $domain ); |
||
| 381 | $fs->write( $path, (string) $image->toWebp( $quality ) ); |
||
| 382 | |||
| 383 | $previews[$width] = $path; |
||
| 384 | unset( $old[$width] ); |
||
| 385 | } |
||
| 386 | |||
| 387 | $item = $this->deletePreviews( $item, $old )->setPreviews( $previews ); |
||
| 388 | |||
| 389 | $this->call( 'scaled', $item, $image ); |
||
| 390 | |||
| 391 | return $item; |
||
| 392 | } |
||
| 393 | |||
| 394 | |||
| 395 | /** |
||
| 396 | * Returns the preview image sizes for scaling the images. |
||
| 397 | * |
||
| 398 | * @param string $domain Domain of the image |
||
| 399 | * @param string $type Type of the image |
||
| 400 | * @return array List of image sizes with "maxwidth", "maxheight" and "force-size" properties |
||
| 401 | */ |
||
| 402 | protected function sizes( string $domain, string $type ) : array |
||
| 403 | { |
||
| 404 | $config = $this->context()->config(); |
||
| 405 | |||
| 406 | /** mshop/media/manager/previews/common |
||
| 407 | * Scaling options for preview images |
||
| 408 | * |
||
| 409 | * For responsive images, several preview images of different sizes are |
||
| 410 | * generated. This setting controls how many preview images are generated, |
||
| 411 | * what's their maximum width and height and if the given width/height is |
||
| 412 | * enforced by cropping images that doesn't fit. |
||
| 413 | * |
||
| 414 | * The setting must consist of a list image size definitions like: |
||
| 415 | * |
||
| 416 | * [ |
||
| 417 | * ['maxwidth' => 240, 'maxheight' => 320, 'force-size' => 2], |
||
| 418 | * ['maxwidth' => 720, 'maxheight' => 960, 'force-size' => 1], |
||
| 419 | * ['maxwidth' => 2160, 'maxheight' => 2880, 'force-size' => 0], |
||
| 420 | * ] |
||
| 421 | * |
||
| 422 | * "maxwidth" sets the maximum allowed width of the image whereas |
||
| 423 | * "maxheight" does the same for the maximum allowed height. If both |
||
| 424 | * values are given, the image is scaled proportionally so it fits into |
||
| 425 | * the box defined by both values. |
||
| 426 | * |
||
| 427 | * In case the image has different proportions than the specified ones |
||
| 428 | * and "force-size" is "0", the image is resized to fit entirely into |
||
| 429 | * the specified box. One side of the image will be shorter than it |
||
| 430 | * would be possible by the specified box. |
||
| 431 | * |
||
| 432 | * If "force-size" is "1", scaled images that doesn't fit into the |
||
| 433 | * given maximum width/height are centered and then filled with the |
||
| 434 | * background color. |
||
| 435 | * |
||
| 436 | * The value of "2" will center the image while the given maxwidth and |
||
| 437 | * maxheight are fully covered and crop the parts of the image which |
||
| 438 | * are outside the box created by maxwidth and maxheight. |
||
| 439 | * |
||
| 440 | * By default, images aren't padded or cropped, only scaled. |
||
| 441 | * |
||
| 442 | * The values for "maxwidth" and "maxheight" can also be null or not |
||
| 443 | * used. In that case, the width or height or both is unbound. If none |
||
| 444 | * of the values are given, the image won't be scaled at all. If only |
||
| 445 | * one value is set, the image will be scaled exactly to the given width |
||
| 446 | * or height and the other side is scaled proportionally. |
||
| 447 | * |
||
| 448 | * You can also define different preview sizes for different domains (e.g. |
||
| 449 | * for catalog images) and for different types (e.g. catalog stage images). |
||
| 450 | * Use configuration settings like |
||
| 451 | * |
||
| 452 | * mshop/media/manager/previews/previews/<domain>/ |
||
| 453 | * mshop/media/manager/previews/previews/<domain>/<type>/ |
||
| 454 | * |
||
| 455 | * for example: |
||
| 456 | * |
||
| 457 | * mshop/media/manager/previews/catalog/previews => [ |
||
| 458 | * ['maxwidth' => 240, 'maxheight' => 320, 'force-size' => true], |
||
| 459 | * ] |
||
| 460 | * mshop/media/manager/previews/catalog/previews => [ |
||
| 461 | * ['maxwidth' => 400, 'maxheight' => 300, 'force-size' => false] |
||
| 462 | * ] |
||
| 463 | * mshop/media/manager/previews/catalog/stage/previews => [ |
||
| 464 | * ['maxwidth' => 360, 'maxheight' => 320, 'force-size' => true], |
||
| 465 | * ['maxwidth' => 720, 'maxheight' => 480, 'force-size' => true] |
||
| 466 | * ] |
||
| 467 | * |
||
| 468 | * These settings will create two preview images for catalog stage images, |
||
| 469 | * one with a different size for all other catalog images and all images |
||
| 470 | * from other domains will be sized to 240x320px. The available domains |
||
| 471 | * which can have images are: |
||
| 472 | * |
||
| 473 | * * attribute |
||
| 474 | * * catalog |
||
| 475 | * * product |
||
| 476 | * * service |
||
| 477 | * * supplier |
||
| 478 | * |
||
| 479 | * There are a few image types included per domain ("default" is always |
||
| 480 | * available). You can also add your own types in the admin backend and |
||
| 481 | * extend the frontend to display them where you need them. |
||
| 482 | * |
||
| 483 | * @param array List of image size definitions |
||
| 484 | * @since 2019.07 |
||
| 485 | */ |
||
| 486 | $sizes = $config->get( 'mshop/media/manager/previews/common', [] ); |
||
| 487 | $sizes = $config->get( 'mshop/media/manager/previews/' . $domain, $sizes ); |
||
| 488 | $sizes = $config->get( 'mshop/media/manager/previews/' . $domain . '/' . $type, $sizes ); |
||
| 489 | |||
| 490 | return $sizes; |
||
| 491 | } |
||
| 492 | |||
| 493 | |||
| 494 | /** |
||
| 495 | * Stores the uploaded file and returns the updated item |
||
| 496 | * |
||
| 497 | * @param \Aimeos\MShop\Media\Item\Iface $item Media item for storing the file meta data, "domain" must be set |
||
| 498 | * @param \Psr\Http\Message\UploadedFileInterface|null $file Uploaded file object |
||
| 499 | * @param \Psr\Http\Message\UploadedFileInterface|null $preview Uploaded preview image |
||
| 500 | * @return \Aimeos\MShop\Media\Item\Iface Updated media item including file and preview paths |
||
| 501 | */ |
||
| 502 | public function upload( \Aimeos\MShop\Media\Item\Iface $item, ?UploadedFileInterface $file, UploadedFileInterface $preview = null ) : \Aimeos\MShop\Media\Item\Iface |
||
| 548 | } |
||
| 549 | |||
| 550 | |||
| 551 | /** mshop/media/manager/resource |
||
| 552 | * Name of the database connection resource to use |
||
| 553 | * |
||
| 554 | * You can configure a different database connection for each data domain |
||
| 555 | * and if no such connection name exists, the "db" connection will be used. |
||
| 556 | * It's also possible to use the same database connection for different |
||
| 557 | * data domains by configuring the same connection name using this setting. |
||
| 558 | * |
||
| 559 | * @param string Database connection name |
||
| 954 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths