當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CurlTransport\BackendDecorator類代碼示例

本文整理匯總了PHP中Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator的典型用法代碼示例。如果您正苦於以下問題:PHP BackendDecorator類的具體用法?PHP BackendDecorator怎麽用?PHP BackendDecorator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BackendDecorator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: persist

 /**
  * Post request for creating widget instance.
  *
  * @param FixtureInterface $fixture [optional]
  * @throws \Exception
  * @return array
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . 'widget_instance/save/type/' . $data['type'] . '/package/' . $this->prepareTheme($data['package_theme']);
     if (isset($data['page_id'])) {
         $data['parameters']['page_id'] = $data['page_id'][0];
         unset($data['page_id']);
     }
     if ($fixture->hasData('store_ids')) {
         $stores = $fixture->getDataFieldConfig('store_ids')['source']->getStores();
         foreach ($stores as $store) {
             $data['store_ids'][] = $store->getStoreId();
         }
     }
     $data['parameters']['unique_id'] = isset($data['parameters']['unique_id']) ? uniqid() : '';
     unset($data['type']);
     unset($data['package_theme']);
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.1', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'class="success-msg"')) {
         throw new \Exception("Widget instance creation by curl handler was not successful! Response: {$response}");
     }
     $id = $this->getWidgetId($response);
     return ['id' => $id];
 }
開發者ID:chucky515,項目名稱:Magento-CE-Mirror,代碼行數:34,代碼來源:Curl.php

示例2: persist

 /**
  * Post request for creating sales rule.
  *
  * @param FixtureInterface $fixture
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $this->mapTypeParams = array_merge($this->mapTypeParams, $this->additionalMapTypeParams);
     $url = $_ENV['app_backend_url'] . 'sales_rule/promo_quote/save/';
     $data = $this->replaceMappingData($fixture->getData());
     $data['rule'] = [];
     if (isset($data['conditions_serialized'])) {
         $data['rule']['conditions'] = $this->prepareCondition($data['conditions_serialized']);
         unset($data['conditions_serialized']);
     }
     $data['website_ids'] = $this->prepareWebsites($data);
     $data['customer_group_ids'] = $this->prepareCustomerGroup($data);
     if (isset($data['actions_serialized'])) {
         $this->mapTypeParams['Conditions combination']['type'] = 'Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Combine';
         $data['rule']['actions'] = $this->prepareCondition($data['actions_serialized']);
         unset($data['actions_serialized']);
     }
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Sales rule entity creating by curl handler was not successful! Response: {$response}");
     }
     preg_match('`<tr.*title=".*sales_rule\\/promo_quote\\/edit\\/id\\/([\\d]+)`ims', $response, $matches);
     if (empty($matches)) {
         throw new \Exception('Cannot find Sales Rule id');
     }
     return ['id' => $matches[1]];
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:37,代碼來源:Curl.php

示例3: persist

 /**
  * Post request for creating currency symbol
  *
  * @param FixtureInterface $fixture
  * @return void
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $fixture->getData();
     $url = $_ENV['app_backend_url'] . 'admin/system_currencysymbol/save';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $curl->read();
     $curl->close();
     // Response verification is absent, because sending a post request returns an index page
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:16,代碼來源:Curl.php

示例4: getRateId

 /**
  * Get Reward exchange rate id.
  *
  * @return string|null
  */
 protected function getRateId()
 {
     $url = $_ENV['app_backend_url'] . 'reward_rate/index/sort/rate_id/dir/desc/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::GET, $url, '1.0');
     $response = $curl->read();
     $curl->close();
     preg_match('@rate_id/(\\d+)@', $response, $match);
     return empty($match[1]) ? null : $match[1];
 }
開發者ID:QiuLihua83,項目名稱:magento-ee,代碼行數:15,代碼來源:Curl.php

示例5: persist

 /**
  * Post request for creating reward points.
  *
  * @param FixtureInterface $fixture
  * @return void
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . 'customer/save/back/edit/tab/customer_info_tabs_customer_edit_tab_reward/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.1', [], $this->prepareData($fixture));
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'class="success-msg"')) {
         throw new \Exception("Adding reward points by curl handler was not successful! Response: {$response}");
     }
 }
開發者ID:MikeTayC,項目名稱:magento.dev,代碼行數:18,代碼來源:Curl.php

示例6: persist

 /**
  * Post request for creating tax class.
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $fixture->getData();
     $url = $_ENV['app_backend_url'] . 'tax/tax/ajaxSave/?isAjax=true';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write($url, $data);
     $response = $curl->read();
     $curl->close();
     $id = $this->getClassId($response);
     return ['id' => $id];
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:17,代碼來源:Curl.php

示例7: getId

 /**
  * Get created user id.
  *
  * @return string
  */
 protected function getId()
 {
     $url = $_ENV['app_backend_url'] . 'permissions_user/roleGrid/sort/user_id/dir/desc/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write(CurlInterface::POST, $url, '1.0');
     $response = $curl->read();
     $curl->close();
     preg_match('@edit/user_id/(\\d+)/@siu', $response, $matches);
     return $matches[1];
 }
開發者ID:cewolf2002,項目名稱:magento,代碼行數:16,代碼來源:Curl.php

示例8: getCustomerGroupId

 /**
  * Get id after creating Customer Group.
  *
  * @param array $data
  * @return string|null
  */
 public function getCustomerGroupId(array $data)
 {
     $regExp = '/.*id\\/(\\d+)\\/.*' . $data['code'] . '/siu';
     $url = $_ENV['app_backend_url'] . 'customer_group/index/sort/time/dir/desc/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::GET, $url, '1.1');
     $response = $curl->read();
     $curl->close();
     preg_match($regExp, $response, $matches);
     return empty($matches[1]) ? null : $matches[1];
 }
開發者ID:chucky515,項目名稱:Magento-CE-Mirror,代碼行數:17,代碼來源:Curl.php

示例9: persist

 /**
  * Post request for creating Event.
  *
  * @param FixtureInterface $fixture
  * @return array
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . 'catalog_event/save/category_id/' . $data['categoryId'] . '/category/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.1', [], $data['data']);
     $response = $curl->read();
     $curl->close();
     $id = $this->getCatalogEventId($response);
     return ['id' => $id];
 }
開發者ID:QiuLihua83,項目名稱:magento-ee,代碼行數:17,代碼來源:Curl.php

示例10: getBlockId

 /**
  * Getting block id by name.
  *
  * @param string $landingName
  * @return int|null
  */
 protected function getBlockId($landingName)
 {
     $url = $_ENV['app_backend_url'] . 'catalog/category';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.0', [], []);
     $response = $curl->read();
     $curl->close();
     preg_match('~<option.*value="(\\d+)".*>' . preg_quote($landingName) . '</option>~', $response, $matches);
     $id = isset($matches[1]) ? (int) $matches[1] : null;
     return $id;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:17,代碼來源:Curl.php

示例11: persist

 /**
  * @param FixtureInterface $fixture [optional]
  * @throws \Exception
  * @return mixed|void
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . $this->url;
     $data = $this->replaceMappingData($fixture->getData());
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write($url, $data);
     $response = $curl->read();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Newsletter template creation by curl was not successful! Response: {$response}");
     }
     $curl->close();
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:17,代碼來源:Curl.php

示例12: persist

 /**
  * Post request for creating url rewrite
  *
  * @param FixtureInterface $fixture
  * @throws \Exception
  * @return void
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . $this->url . $fixture->getTargetPath();
     $data = $this->replaceMappingData($fixture->getData());
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $response = $curl->read();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("URL Rewrite creation by curl handler was not successful! Response: {$response}");
     }
     $curl->close();
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:19,代碼來源:Curl.php

示例13: persist

 /**
  * Post request for setting currency rate.
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . 'admin/system_currency/saveRates/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Currency rates setting by curl handler was not successful! Response:\n" . $response);
     }
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:19,代碼來源:Curl.php

示例14: persist

 /**
  * Execute handler
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed
  */
 public function persist(FixtureInterface $fixture = null)
 {
     /** @var \Magento\Customer\Test\Fixture\CustomerGroup $fixture*/
     $params = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . $this->saveUrl;
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $params);
     $response = $curl->read();
     $curl->close();
     return $this->findId($response, $fixture->getGroupName());
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:18,代碼來源:CreateCustomerGroup.php

示例15: persist

 /**
  * Curl creation of User Role.
  *
  * @param FixtureInterface $fixture [optional]
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . 'permissions_role/saverole/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.1', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'class="success-msg"')) {
         throw new \Exception("Role entity creating by curl handler was not successful! Response: {$response}");
     }
     return ['role_id' => $this->getRoleId($response)];
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:20,代碼來源:Curl.php


注:本文中的Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。