Spamworldpro Mini Shell
Spamworldpro


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/app/code/Cnc/Catalog/Model/ResourceModel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/app/code/Cnc/Catalog/Model/ResourceModel/Data.php
<?php
/**
 * Copyright (c) 2020 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved.
 * https://opensource.org/licenses/OSL-3.0  Open Software License (OSL 3.0)
 * Cnc
 * Radosław Stępień <[email protected]> <[email protected]>
 */
namespace Cnc\Catalog\Model\ResourceModel;

use ArrayIterator;
use Iterator;
use IteratorAggregate;
use Magento\Framework\Model\ResourceModel\Db\Context;

class Data extends \Magento\ImportExport\Model\ResourceModel\Import\Data implements IteratorAggregate
{
    /**
     * @var Iterator
     */
    protected $_iterator = null;
    /**
     * @var array
     */
    private $data;

    /**
     * Data constructor.
     *
     * @param Context $context
     * @param \Magento\Framework\Json\Helper\Data $jsonHelper
     * @param null $connectionName
     * @param array $data
     */
    public function __construct(
        Context $context,
        \Magento\Framework\Json\Helper\Data $jsonHelper,
        $connectionName = null,
        $data = []
    ) {
        parent::__construct($context, $jsonHelper, $connectionName);
        $this->data = $data;
    }

    /**
     * Get next bunch of validated rows.
     *
     * @return array|null
     */
    public function getNextBunch()
    {
        if (null === $this->_iterator) {
            $this->_iterator = $this->getIterator();
            $this->_iterator->rewind();
        }
        $dataRow = null;
        if ($this->_iterator->valid()) {
            $dataRow = $this->_iterator->current();
            $this->_iterator->next();
        }
        if (!$dataRow) {
            $this->_iterator = null;
        }

        return $dataRow;
    }

    /**
     * Retrieve an external iterator
     *
     * @return Iterator
     */
    public function getIterator()
    {
        $iterator = new ArrayIterator($this->data);

        return $iterator;
    }

    /**
     * Omit ResourceModel database binding while constructing the model
     */
    protected function _construct()
    {
        return $this;
    }
}

Spamworldpro Mini