Issues (3641)

MessageBroker/AssetAddedMessageHandlerPlugin.php (1 issue)

1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace Spryker\Zed\Asset\Communication\Plugin\MessageBroker;
9
10
use Generated\Shared\Transfer\AssetAddedTransfer;
11
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
12
use Spryker\Zed\MessageBrokerExtension\Dependency\Plugin\MessageHandlerPluginInterface;
13
14
/**
15
 * @deprecated Use {@link \Spryker\Zed\Asset\Communication\Plugin\MessageBroker\AssetMessageHandlerPlugin} instead.
16
 *
17
 * @method \Spryker\Zed\Asset\Communication\AssetCommunicationFactory getFactory()
18
 * @method \Spryker\Zed\Asset\Business\AssetFacadeInterface getFacade()
19
 * @method \Spryker\Zed\Asset\AssetConfig getConfig()
20
 */
21
class AssetAddedMessageHandlerPlugin extends AbstractPlugin implements MessageHandlerPluginInterface
22
{
23
    /**
24
     * {@inheritDoc}
25
     *
26
     * @api
27
     *
28
     * @param \Generated\Shared\Transfer\AssetAddedTransfer $assetAddedTransfer
29
     *
30
     * @return void
31
     */
32
    public function onAssetAdded(AssetAddedTransfer $assetAddedTransfer): void
33
    {
34
        $this->getFacade()->addAsset($assetAddedTransfer);
35
    }
36
37
    /**
38
     * {@inheritDoc}
39
     * - Return an array where the key is the class name to be handled and the value is the callable that handles the message.
40
     *
41
     * @api
42
     *
43
     * @return array<string, callable>
44
     */
45
    public function handles(): iterable
46
    {
47
        yield AssetAddedTransfer::class => [$this, 'onAssetAdded'];
0 ignored issues
show
Bug Best Practice introduced by
The expression yield Generated\Shared\T...($this, 'onAssetAdded') returns the type Generator which is incompatible with the documented return type array<string,callable>.
Loading history...
48
    }
49
}
50