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

Public Member Functions

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

Protected Attributes

 $_options
 

Detailed Description

Definition at line 40 of file LocalizedToNormalized.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $options = null)

Class constructor

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

Definition at line 57 of file LocalizedToNormalized.php.

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

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 98 of file LocalizedToNormalized.php.

99  {
100  if (Zend_Locale_Format::isNumber($value, $this->_options)) {
101  return Zend_Locale_Format::getNumber($value, $this->_options);
102  } else if (($this->_options['date_format'] === null) && (strpos($value, ':') !== false)) {
103  // Special case, no date format specified, detect time input
104  return Zend_Locale_Format::getTime($value, $this->_options);
105  } else if (Zend_Locale_Format::checkDateFormat($value, $this->_options)) {
106  // Detect date or time input
107  return Zend_Locale_Format::getDate($value, $this->_options);
108  }
109 
110  return $value;
111  }
static getDate($date, array $options=array())
Definition: Format.php:1154
static isNumber($input, array $options=array())
Definition: Format.php:510
$value
Definition: gender.phtml:16
static getTime($time, array $options=array())
Definition: Format.php:1252
static checkDateFormat($date, array $options=array())
Definition: Format.php:1174
static getNumber($input, array $options=array())
Definition: Format.php:246

◆ getOptions()

getOptions ( )

Returns the set options

Returns
array

Definition at line 73 of file LocalizedToNormalized.php.

◆ setOptions()

setOptions ( array  $options = null)

Sets options to use

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

Definition at line 84 of file LocalizedToNormalized.php.

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

Field Documentation

◆ $_options

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

Definition at line 46 of file LocalizedToNormalized.php.


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