Passed
Push — trunk ( 20883f...08adc9 )
by Christian
12:47 queued 15s
created

MediaUploadedEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 8
dl 0
loc 30
rs 10
c 1
b 1
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getContext() 0 3 1
A getName() 0 3 1
A getMediaId() 0 3 1
A __construct() 0 4 1
A getAvailableData() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Content\Media\Event;
4
5
use Shopware\Core\Content\Flow\Dispatching\Aware\MediaUploadedAware;
6
use Shopware\Core\Framework\Context;
7
use Shopware\Core\Framework\Event\EventData\EventDataCollection;
8
use Shopware\Core\Framework\Event\EventData\ScalarValueType;
9
use Shopware\Core\Framework\Log\Package;
10
use Symfony\Contracts\EventDispatcher\Event;
11
12
#[Package('content')]
13
class MediaUploadedEvent extends Event implements MediaUploadedAware
14
{
15
    public const EVENT_NAME = 'media.uploaded';
16
17
    public function __construct(
18
        private readonly string $mediaId,
19
        private readonly Context $context
20
    ) {
21
    }
22
23
    public function getName(): string
24
    {
25
        return self::EVENT_NAME;
26
    }
27
28
    public static function getAvailableData(): EventDataCollection
29
    {
30
        return (new EventDataCollection())
31
            ->add('mediaId', new ScalarValueType(ScalarValueType::TYPE_STRING));
32
    }
33
34
    public function getMediaId(): string
35
    {
36
        return $this->mediaId;
37
    }
38
39
    public function getContext(): Context
40
    {
41
        return $this->context;
42
    }
43
}
44