<?php

namespace Webkul\WooCommerceBundle\Connector\Writer;

use Webkul\WooCommerceBundle\Services\WooCommerceConnector;
use Webkul\WooCommerceBundle\Listener\ClassDefinationForCompatibility;

$obj = new ClassDefinationForCompatibility();
$obj->objectCreate();

/**
 * Add resources to woocommerce
 *
 * @author    Webkul Software Pvt Ltd
 * @copyright 2010-2017 Webkul pvt. ltd.
 * @license   https://store.webkul.com/license.html
 */
class BaseWriter implements \StepExecutionAwareInterface
{
    protected $connectorService;

    protected $stepExecution;
    
    /** @var JobInstance */
    protected $jobInstance;


    /**
     * {@inheritdoc}
     */
    public function setStepExecution(\StepExecution $stepExecution)
    {
        $this->stepExecution = $stepExecution;
        if (!empty($this->connectorService) && $this->connectorService instanceof WooCommerceConnector) {
            $this->connectorService->setStepExecution($stepExecution);
        }
    }

    public function __construct(WooCommerceConnector $connectorService)
    {
        $this->connectorService = $connectorService;
    }


    /**
     * Get job name
     *
     * @return string
     */
    public function getJobName()
    {
        return $this->stepExecution->getJobExecution()->getJobInstance()->getJobName();
    }

}
