Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Zend_Filter_NormalizedToLocalized Class Reference
Inheritance diagram for Zend_Filter_NormalizedToLocalized:
Zend_Filter_Interface

Public Member Functions

 __construct ($options=null)
 
 getOptions ()
 
 setOptions (array $options=null)
 
 filter ($value)
 

Protected Attributes

 $_options
 

Detailed Description

Definition at line 40 of file NormalizedToLocalized.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $options = null)

Class constructor

Parameters
string | Zend_Locale$locale(Optional) Locale to set

Definition at line 56 of file NormalizedToLocalized.php.

57  {
58  if ($options instanceof Zend_Config) {
59  $options = $options->toArray();
60  }
61 
62  if (null !== $options) {
63  $this->setOptions($options);
64  }
65  }

Member Function Documentation

◆ filter()

filter (   $value)

Defined by Zend_Filter_Interface

Normalizes the given input

Parameters
string$valueValue to normalized
Returns
string|array The normalized value

Implements Zend_Filter_Interface.

Definition at line 97 of file NormalizedToLocalized.php.

98  {
99  if (is_array($value)) {
100  #require_once 'Zend/Date.php';
101  $date = new Zend_Date($value, $this->_options['locale']);
102  return $date->toString($this->_options['date_format']);
103  } else if ($this->_options['precision'] === 0) {
104  return Zend_Locale_Format::toInteger($value, $this->_options);
105  } else if ($this->_options['precision'] === null) {
106  return Zend_Locale_Format::toFloat($value, $this->_options);
107  }
108 
109  return Zend_Locale_Format::toNumber($value, $this->_options);
110  }
static toFloat($value, array $options=array())
Definition: Format.php:659
$value
Definition: gender.phtml:16
static toInteger($value, array $options=array())
Definition: Format.php:707
static toNumber($value, array $options=array())
Definition: Format.php:300

◆ getOptions()

getOptions ( )

Returns the set options

Returns
array

Definition at line 72 of file NormalizedToLocalized.php.

◆ setOptions()

setOptions ( array  $options = null)

Sets options to use

Parameters
array$options(Optional) Options to use
Returns
Zend_Filter_LocalizedToNormalized

Definition at line 83 of file NormalizedToLocalized.php.

84  {
85  $this->_options = $options + $this->_options;
86  return $this;
87  }

Field Documentation

◆ $_options

$_options
protected
Initial value:
= array(
'locale' => null,
'date_format' => null,
'precision' => null
)

Set options

Definition at line 45 of file NormalizedToLocalized.php.


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