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

MediaUploadedEvent::getContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 1
f 0
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