Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Numeric.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Element.php';
25 
26 
36 {
42  public $value;
43 
44 
51  public function __construct($val)
52  {
53  if ( !is_numeric($val) ) {
54  #require_once 'Zend/Pdf/Exception.php';
55  throw new Zend_Pdf_Exception('Argument must be numeric');
56  }
57 
58  $this->value = $val;
59  }
60 
61 
67  public function getType()
68  {
70  }
71 
72 
79  public function toString($factory = null)
80  {
81  if (is_integer($this->value)) {
82  return (string)$this->value;
83  }
84 
89  $prec = 0; $v = $this->value;
90  while (abs( floor($v) - $v ) > 1e-10) {
91  $prec++; $v *= 10;
92  }
93  return sprintf("%.{$prec}F", $this->value);
94  }
95 }
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
const TYPE_NUMERIC
Definition: Element.php:33
toString($factory=null)
Definition: Numeric.php:79