Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractIncrement.php
Go to the documentation of this file.
1 <?php
7 
18 abstract class AbstractIncrement extends \Magento\Framework\DataObject implements
19  \Magento\Eav\Model\Entity\Increment\IncrementInterface
20 {
26  public function getPadLength()
27  {
28  $padLength = $this->getData('pad_length');
29  if (empty($padLength)) {
30  $padLength = 8;
31  }
32  return $padLength;
33  }
34 
40  public function getPadChar()
41  {
42  $padChar = $this->getData('pad_char');
43  if (empty($padChar)) {
44  $padChar = '0';
45  }
46  return $padChar;
47  }
48 
55  public function format($id)
56  {
57  $result = $this->getPrefix();
58  $result .= str_pad((string)$id, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT);
59  return $result;
60  }
61 
69  public function frontendFormat($id)
70  {
71  return $id;
72  }
73 }
getData($key='', $index=null)
Definition: DataObject.php:119
$id
Definition: fieldset.phtml:14