当前位置: 首页>>代码示例>>PHP>>正文


PHP Http::isSecure方法代码示例

本文整理汇总了PHP中Magento\Framework\App\Request\Http::isSecure方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::isSecure方法的具体用法?PHP Http::isSecure怎么用?PHP Http::isSecure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\App\Request\Http的用法示例。


在下文中一共展示了Http::isSecure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 /**
  * Handle private content version cookie
  * Set cookie if it is not set.
  * Increment version on post requests.
  * In all other cases do nothing.
  *
  * @return void
  */
 public function process()
 {
     if ($this->request->isPost()) {
         $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration(self::COOKIE_PERIOD)->setPath('/')->setSecure($this->request->isSecure())->setHttpOnly(false);
         $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $this->generateValue(), $publicCookieMetadata);
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:Version.php

示例2: testIsSecure

 /**
  * @dataProvider isSecureDataProvider
  *
  * @param bool $isSecure expected output of isSecure method
  * @param string $serverHttps value of $_SERVER['HTTPS']
  * @param string $headerOffloadKey <Name-Of-Offload-Header>
  * @param string $headerOffloadValue value of $_SERVER[<Name-Of-Offload-Header>]
  * @param int $configCall number of times config->getValue is expected to be called
  */
 public function testIsSecure($isSecure, $serverHttps, $headerOffloadKey, $headerOffloadValue, $configCall)
 {
     $this->_model = $this->getModel();
     $configOffloadHeader = 'Header-From-Proxy';
     $configMock = $this->getMockBuilder('Magento\\Framework\\App\\Config')->disableOriginalConstructor()->setMethods(['getValue'])->getMock();
     $configMock->expects($this->exactly($configCall))->method('getValue')->with(\Magento\Framework\App\Request\Http::XML_PATH_OFFLOADER_HEADER, ScopeConfigInterface::SCOPE_TYPE_DEFAULT)->willReturn($configOffloadHeader);
     $this->objectManager->expects($this->exactly($configCall))->method('get')->with('Magento\\Framework\\App\\Config')->will($this->returnValue($configMock));
     $this->_model->getServer()->set($headerOffloadKey, $headerOffloadValue);
     $this->_model->getServer()->set('HTTPS', $serverHttps);
     $this->assertSame($isSecure, $this->_model->isSecure());
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:20,代码来源:HttpTest.php

示例3: __construct

 /**
  * @param \Magento\Framework\App\Request\Http $request
  */
 public function __construct(\Magento\Framework\App\Request\Http $request)
 {
     $data = [$request->isSecure(), $request->getRequestUri(), $request->get(\Magento\Framework\App\Response\Http::COOKIE_VARY_STRING)];
     $this->value = md5(serialize($data));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:8,代码来源:Identifier.php

示例4: getValue

 /**
  * Return unique page identifier
  *
  * @return string
  */
 public function getValue()
 {
     $data = [$this->request->isSecure(), $this->request->getUriString(), $this->request->get(\Magento\Framework\App\Response\Http::COOKIE_VARY_STRING) ?: $this->context->getVaryString()];
     return md5(serialize($data));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:Identifier.php


注:本文中的Magento\Framework\App\Request\Http::isSecure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。