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/vendor/extmag/shiplab/Helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/extmag/shiplab/Helper/DataPrepareFactory.php
<?php
/**
 * Copyright © Extmag. All rights reserved.
 */

namespace Extmag\Shiplab\Helper;

use Extmag\Shiplab\Model\Source\CarrierCodes;
use Exception;
use Magento\Framework\ObjectManagerInterface;

class DataPrepareFactory
{
    /**
     * @var ObjectManagerInterface
     */
    protected $objectManager;
    /**
     * @var CarrierCodes
     */
    protected $carrierCodes;

    /**
     * @param ObjectManagerInterface $objectManager
     * @param CarrierCodes $carrierCodes
     */
    public function __construct(ObjectManagerInterface $objectManager, CarrierCodes $carrierCodes)
    {
        $this->objectManager = $objectManager;
        $this->carrierCodes = $carrierCodes;
    }

    /**
     * Create new data prepare object
     *
     * @param string $carrierCode
     * @return DataPrepare
     * @throws Exception
     */
    public function create(string $carrierCode)
    {
        $carrierData = $this->carrierCodes->getCarriers($carrierCode);
        if (!empty($carrierData['data_prepare_class'])) {
            return $this->objectManager->create($carrierData['data_prepare_class']);
        }

        throw new Exception(__('Carrier is not found'));
    }

    /**
     * Get existing data prepare object
     *
     * @param string $carrierCode
     * @return mixed
     * @throws Exception
     */
    public function get(string $carrierCode)
    {
        $carrierData = $this->carrierCodes->getCarriers($carrierCode);
        if (!empty($carrierData['data_prepare_class'])) {
            return $this->objectManager->get($carrierData['data_prepare_class']);
        }

        throw new Exception(__('Carrier is not found'));
    }
}

Spamworldpro Mini