Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Sprintf.php
Go to the documentation of this file.
1 <?php
7 
9 {
13  protected $format;
14 
18  protected $decimals;
19 
23  protected $decPoint;
24 
28  protected $thousandsSep;
29 
36  public function __construct($format, $decimals = null, $decPoint = '.', $thousandsSep = ',')
37  {
38  $this->format = $format;
39  $this->decimals = $decimals;
40  $this->decPoint = $decPoint;
41  $this->thousandsSep = $thousandsSep;
42  }
43 
48  public function filter($value)
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  }
56 }
$value
Definition: gender.phtml:16
__construct($format, $decimals=null, $decPoint='.', $thousandsSep=',')
Definition: Sprintf.php:36