/**
  * @param $shopName string
  */
 public function __construct($shopName, $clientConfig = null)
 {
     if (empty($shopName)) {
         throw new InvalidArgumentException('shopName not provided');
     }
     $this->shopName = $shopName;
     if ($clientConfig) {
         $this->setClientConfig($clientConfig);
     }
     if (is_array($clientConfig) && isset($clientConfig['scope'])) {
         $this->setContext(new Context($clientConfig['client_id'], $clientConfig['scope']));
     }
     self::$instance = $this;
     return $this;
 }
Example #2
0
 /**
  * @param \stdClass $clientConfig
  * @param TokenStorage $tokenStorage
  */
 public function __construct(\stdClass $clientConfig, TokenStorage $tokenStorage = null)
 {
     if (empty($clientConfig)) {
         throw new InvalidArgumentException('clientConfig not provided');
     }
     if (empty($clientConfig->shopname)) {
         throw new InvalidArgumentException('shopname not provided');
     }
     if (empty($clientConfig->scope)) {
         throw new InvalidArgumentException('scope not provided');
     }
     $this->shopName = $clientConfig->shopname;
     $this->auth = new OAuth2($clientConfig, $tokenStorage);
     self::$instance = $this;
     return $this;
 }