Passed
Push — trunk ( 9b0a66...54d57b )
by Christian
27:18 queued 11:16
created

MediaUploadedEvent::getValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Content\Media\Event;
4
5
use Shopware\Core\Content\Flow\Dispatching\Action\FlowMailVariables;
6
use Shopware\Core\Content\Flow\Dispatching\Aware\MediaUploadedAware;
7
use Shopware\Core\Content\Flow\Dispatching\Aware\ScalarValuesAware;
8
use Shopware\Core\Framework\Context;
9
use Shopware\Core\Framework\Event\EventData\EventDataCollection;
10
use Shopware\Core\Framework\Event\EventData\ScalarValueType;
11
use Shopware\Core\Framework\Event\FlowEventAware;
12
use Shopware\Core\Framework\Log\Package;
13
use Symfony\Contracts\EventDispatcher\Event;
14
15
/**
16
 * @deprecated tag:v6.6.0 - reason:class-hierarchy-change - MediaUploadedAware is deprecated and will be removed in v6.6.0
17
 */
18
#[Package('content')]
19
class MediaUploadedEvent extends Event implements MediaUploadedAware, ScalarValuesAware, FlowEventAware
0 ignored issues
show
Deprecated Code introduced by
The interface Shopware\Core\Content\Fl...ware\MediaUploadedAware has been deprecated: tag:v6.6.0 - Will be removed, use ScalarValuesStorer/ScalarValuesAware instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

19
class MediaUploadedEvent extends Event implements /** @scrutinizer ignore-deprecated */ MediaUploadedAware, ScalarValuesAware, FlowEventAware

This interface has been deprecated. The supplier of the interface has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.

Loading history...
20
{
21
    public const EVENT_NAME = 'media.uploaded';
22
23
    public function __construct(
24
        private readonly string $mediaId,
25
        private readonly Context $context
26
    ) {
27
    }
28
29
    public function getName(): string
30
    {
31
        return self::EVENT_NAME;
32
    }
33
34
    public static function getAvailableData(): EventDataCollection
35
    {
36
        return (new EventDataCollection())
37
            ->add('mediaId', new ScalarValueType(ScalarValueType::TYPE_STRING));
38
    }
39
40
    public function getValues(): array
41
    {
42
        return [
43
            FlowMailVariables::MEDIA_ID => $this->mediaId,
44
        ];
45
    }
46
47
    public function getMediaId(): string
48
    {
49
        return $this->mediaId;
50
    }
51
52
    public function getContext(): Context
53
    {
54
        return $this->context;
55
    }
56
}
57