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

Public Member Functions

 __construct ($format, $decimals=null, $decPoint='.', $thousandsSep=',')
 
 filter ($value)
 

Protected Attributes

 $format
 
 $decimals
 
 $decPoint
 
 $thousandsSep
 

Detailed Description

Definition at line 8 of file Sprintf.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $format,
  $decimals = null,
  $decPoint = '.',
  $thousandsSep = ',' 
)
Parameters
string$format
null | int$decimals
string$decPoint
string$thousandsSep

Definition at line 36 of file Sprintf.php.

37  {
38  $this->format = $format;
39  $this->decimals = $decimals;
40  $this->decPoint = $decPoint;
41  $this->thousandsSep = $thousandsSep;
42  }

Member Function Documentation

◆ filter()

filter (   $value)
Parameters
string$value
Returns
string

Implements Zend_Filter_Interface.

Definition at line 48 of file Sprintf.php.

49  {
50  if (null !== $this->decimals) {
51  $value = number_format($value, $this->decimals, $this->decPoint, $this->thousandsSep);
52  }
53  $value = sprintf($this->format, $value);
54  return $value;
55  }
$value
Definition: gender.phtml:16

Field Documentation

◆ $decimals

$decimals
protected

Definition at line 18 of file Sprintf.php.

◆ $decPoint

$decPoint
protected

Definition at line 23 of file Sprintf.php.

◆ $format

$format
protected

Definition at line 13 of file Sprintf.php.

◆ $thousandsSep

$thousandsSep
protected

Definition at line 28 of file Sprintf.php.


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