ShopifyFactory.php 673 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
<?php
/**
 * Created by PhpStorm.
 * User: Zero
 * Date: 2020/8/19
 * Time: 9:25
 */

namespace Meibuyu\Micro\Shopify;

use Hyperf\Contract\ContainerInterface;

class ShopifyFactory
{

    /**
     * @var ContainerInterface
     */
    private $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    public function create(array $config = []): ShopifyApp
    {
        if (method_exists($this->container, 'make')) {
            // Create by DI for AOP.
            return $this->container->make(ShopifyApp::class, ['config' => $config]);
        }
        return new ShopifyApp($config);
    }

}