![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-newsletter/Model/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Newsletter\Model; use Magento\Newsletter\Model\ResourceModel\Queue\Collection; use Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory; /** * Newsletter module observer * * @SuppressWarnings(PHPMD.LongVariable) */ class Observer { /** * Number of queue */ private const COUNT_OF_QUEUE = 3; /** * Number of subscriptions */ private const COUNT_OF_SUBSCRIPTIONS = 20; /** * First page in collection */ private const FIRST_PAGE = 1; /** * Queue collection factory * * @var CollectionFactory */ protected $_queueCollectionFactory; /** * Construct * * @param CollectionFactory $queueCollectionFactory */ public function __construct( CollectionFactory $queueCollectionFactory ) { $this->_queueCollectionFactory = $queueCollectionFactory; } /** * Scheduled send handler * * @return void */ public function scheduledSend() { /** @var Collection $collection */ $collection = $this->_queueCollectionFactory->create(); $collection->setPageSize(self::COUNT_OF_QUEUE) ->setCurPage(self::FIRST_PAGE)->addOnlyForSendingFilter()->load(); $collection->walk('sendPerSubscriber', [self::COUNT_OF_SUBSCRIPTIONS]); } }