Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Remember.php
Go to the documentation of this file.
1 <?php
7 
16 {
22  protected $_persistentData = null;
23 
27  protected $mathRandom;
28 
35  public function __construct(
36  \Magento\Framework\View\Element\Template\Context $context,
37  \Magento\Persistent\Helper\Data $persistentData,
38  \Magento\Framework\Math\Random $mathRandom,
39  array $data = []
40  ) {
41  $this->_persistentData = $persistentData;
42  $this->mathRandom = $mathRandom;
43  parent::__construct($context, $data);
44  }
45 
51  protected function _toHtml()
52  {
53  return $this->_persistentData->isEnabled() &&
54  $this->_persistentData->isRememberMeEnabled() ? parent::_toHtml() : '';
55  }
56 
62  public function isRememberMeChecked()
63  {
64  return $this->_persistentData->isEnabled() &&
65  $this->_persistentData->isRememberMeEnabled() &&
66  $this->_persistentData->isRememberMeCheckedDefault();
67  }
68 
77  public function getRandomString($length, $chars = null)
78  {
79  return $this->mathRandom->getRandomString($length, $chars);
80  }
81 }
getRandomString($length, $chars=null)
Definition: Remember.php:77
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Persistent\Helper\Data $persistentData, \Magento\Framework\Math\Random $mathRandom, array $data=[])
Definition: Remember.php:35