Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Zend_Filter_Encrypt Class Reference
Inheritance diagram for Zend_Filter_Encrypt:
Zend_Filter_Interface Encrypt Zend_Filter_Decrypt Zend_Filter_File_Encrypt Decrypt Zend_Filter_File_Decrypt

Public Member Functions

 __construct ($options=null)
 
 getAdapter ()
 
 setAdapter ($options=null)
 
 __call ($method, $options)
 
 filter ($value)
 

Protected Attributes

 $_adapter
 

Detailed Description

Definition at line 40 of file Encrypt.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $options = null)

Class constructor

Parameters
string | array$options(Optional) Options to set, if null mcrypt is used

Definition at line 52 of file Encrypt.php.

53  {
54  if ($options instanceof Zend_Config) {
55  $options = $options->toArray();
56  }
57 
58  $this->setAdapter($options);
59  }
setAdapter($options=null)
Definition: Encrypt.php:77

Member Function Documentation

◆ __call()

__call (   $method,
  $options 
)

Calls adapter methods

Parameters
string$methodMethod to call
string | array$optionsOptions for this method

Definition at line 115 of file Encrypt.php.

116  {
117  $part = substr($method, 0, 3);
118  if ((($part != 'get') and ($part != 'set')) or !method_exists($this->_adapter, $method)) {
119  #require_once 'Zend/Filter/Exception.php';
120  throw new Zend_Filter_Exception("Unknown method '{$method}'");
121  }
122 
123  return call_user_func_array(array($this->_adapter, $method), $options);
124  }
$method
Definition: info.phtml:13

◆ filter()

filter (   $value)

Defined by Zend_Filter_Interface

Encrypts the content $value with the defined settings

Parameters
string$valueContent to encrypt
Returns
string The encrypted content

Implements Zend_Filter_Interface.

Definition at line 134 of file Encrypt.php.

135  {
136  return $this->_adapter->encrypt($value);
137  }
$value
Definition: gender.phtml:16

◆ getAdapter()

getAdapter ( )

Returns the name of the set adapter

Returns
string

Definition at line 66 of file Encrypt.php.

67  {
68  return $this->_adapter->toString();
69  }

◆ setAdapter()

setAdapter (   $options = null)

Sets new encryption options

Parameters
string | array$options(Optional) Encryption options
Returns
Zend_Filter_Encrypt

Definition at line 77 of file Encrypt.php.

78  {
79  if (is_string($options)) {
81  } else if (isset($options['adapter'])) {
82  $adapter = $options['adapter'];
83  unset($options['adapter']);
84  } else {
85  $adapter = 'Mcrypt';
86  }
87 
88  if (!is_array($options)) {
89  $options = array();
90  }
91 
92  if (Zend_Loader::isReadable('Zend/Filter/Encrypt/' . ucfirst($adapter). '.php')) {
93  $adapter = 'Zend_Filter_Encrypt_' . ucfirst($adapter);
94  }
95 
96  if (!class_exists($adapter)) {
98  }
99 
100  $this->_adapter = new $adapter($options);
101  if (!$this->_adapter instanceof Zend_Filter_Encrypt_Interface) {
102  #require_once 'Zend/Filter/Exception.php';
103  throw new Zend_Filter_Exception("Encoding adapter '" . $adapter . "' does not implement Zend_Filter_Encrypt_Interface");
104  }
105 
106  return $this;
107  }
static loadClass($class, $dirs=null)
Definition: Loader.php:52
$adapter
Definition: webapi_user.php:16
static isReadable($filename)
Definition: Loader.php:162

Field Documentation

◆ $_adapter

$_adapter
protected

Encryption adapter

Definition at line 45 of file Encrypt.php.


The documentation for this class was generated from the following file: