本文整理汇总了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);
}
}
示例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());
}
示例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));
}
示例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));
}