Passed
Push — trunk ( 56bff9...f69f6d )
by Christian
10:36 queued 12s
created

GenerateThumbnailsMessage::getContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Content\Media\Message;
4
5
use Shopware\Core\Framework\Context;
6
use Shopware\Core\Framework\Feature;
7
use Shopware\Core\Framework\Log\Package;
8
use Shopware\Core\Framework\MessageQueue\AsyncMessageInterface;
9
10
#[Package('content')]
11
class GenerateThumbnailsMessage implements AsyncMessageInterface
12
{
13
    /**
14
     * @var array<string>
15
     */
16
    private array $mediaIds = [];
17
18
    private Context $context;
19
20
    /**
21
     * @deprecated tag:v6.6.0 - Property will be removed, use context instead
22
     */
23
    private string $contextData;
24
25
    /**
26
     * @return array<string>
27
     */
28
    public function getMediaIds(): array
29
    {
30
        return $this->mediaIds;
31
    }
32
33
    /**
34
     * @param array<string> $mediaIds
35
     */
36
    public function setMediaIds(array $mediaIds): void
37
    {
38
        $this->mediaIds = $mediaIds;
39
    }
40
41
    public function getContextData(): string
42
    {
43
        return $this->contextData;
0 ignored issues
show
Deprecated Code introduced by
The property Shopware\Core\Content\Me...lsMessage::$contextData has been deprecated: tag:v6.6.0 - Property will be removed, use context instead ( Ignorable by Annotation )

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

43
        return /** @scrutinizer ignore-deprecated */ $this->contextData;

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

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

Loading history...
44
    }
45
46
    public function setContextData(string $contextData): void
47
    {
48
        $this->contextData = $contextData;
0 ignored issues
show
Deprecated Code introduced by
The property Shopware\Core\Content\Me...lsMessage::$contextData has been deprecated: tag:v6.6.0 - Property will be removed, use context instead ( Ignorable by Annotation )

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

48
        /** @scrutinizer ignore-deprecated */ $this->contextData = $contextData;

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

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

Loading history...
49
    }
50
51
    /**
52
     * @deprecated tag:v6.6.0 - Will be removed
53
     */
54
    public function withContext(Context $context): GenerateThumbnailsMessage
55
    {
56
        Feature::triggerDeprecationOrThrow(
57
            'v6.6.0.0',
58
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0')
59
        );
60
        $this->contextData = serialize($context);
0 ignored issues
show
Deprecated Code introduced by
The property Shopware\Core\Content\Me...lsMessage::$contextData has been deprecated: tag:v6.6.0 - Property will be removed, use context instead ( Ignorable by Annotation )

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

60
        /** @scrutinizer ignore-deprecated */ $this->contextData = serialize($context);

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

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

Loading history...
61
62
        return $this;
63
    }
64
65
    /**
66
     * @deprecated tag:v6.6.0 - Will be removed
67
     */
68
    public function readContext(): Context
69
    {
70
        Feature::triggerDeprecationOrThrow(
71
            'v6.6.0.0',
72
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0')
73
        );
74
75
        return unserialize($this->contextData);
0 ignored issues
show
Deprecated Code introduced by
The property Shopware\Core\Content\Me...lsMessage::$contextData has been deprecated: tag:v6.6.0 - Property will be removed, use context instead ( Ignorable by Annotation )

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

75
        return unserialize(/** @scrutinizer ignore-deprecated */ $this->contextData);

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

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

Loading history...
76
    }
77
78
    public function getContext(): Context
79
    {
80
        return $this->context;
81
    }
82
83
    public function setContext(Context $context): void
84
    {
85
        $this->context = $context;
86
    }
87
}
88