Passed
Push — master ( 60a4ae...29fcc8 )
by
unknown
46:42 queued 14:26
created

CmsPageMessageHandlerPlugin   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handles() 0 5 1
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
declare(strict_types=1);
9
10
namespace Spryker\Zed\Cms\Communication\Plugin\MessageBroker;
11
12
use Generated\Shared\Transfer\InitializeCmsPageExportTransfer;
13
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
14
use Spryker\Zed\MessageBrokerExtension\Dependency\Plugin\MessageHandlerPluginInterface;
15
16
/**
17
 * @method \Spryker\Zed\Cms\Business\CmsFacadeInterface getFacade()
18
 * @method \Spryker\Zed\Cms\CmsConfig getConfig()
19
 * @method \Spryker\Zed\Cms\Communication\CmsCommunicationFactory getFactory()
20
 * @method \Spryker\Zed\Cms\Persistence\CmsQueryContainerInterface getQueryContainer()
21
 * @method \Spryker\Zed\Cms\Business\CmsBusinessFactory getBusinessFactory()()
22
 */
23
class CmsPageMessageHandlerPlugin extends AbstractPlugin implements MessageHandlerPluginInterface
24
{
25
    /**
26
     * {@inheritDoc}
27
     * - Handles `InitializeCmsPageExportTransfer` message by triggering `Entity.spy_cms_page.export` events for all active cms pages.
28
     *
29
     * @api
30
     *
31
     * @return array<string, callable>
32
     */
33
    public function handles(): iterable
34
    {
35
        return [
36
            InitializeCmsPageExportTransfer::class => function (): void {
37
                $this->getBusinessFactory()->createCmsPageEventExporter()->export();
38
            },
39
        ];
40
    }
41
}
42