NumericValue.php 769 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Eav\Model\Entity\Increment;
  7. /**
  8. * Enter description here...
  9. *
  10. * Properties:
  11. * - prefix
  12. * - pad_length
  13. * - pad_char
  14. * - last_id
  15. *
  16. * @api
  17. * @since 100.0.2
  18. */
  19. class NumericValue extends \Magento\Eav\Model\Entity\Increment\AbstractIncrement
  20. {
  21. /**
  22. * Get next id
  23. *
  24. * @return string
  25. */
  26. public function getNextId()
  27. {
  28. $last = $this->getLastId();
  29. if (strpos($last, $this->getPrefix()) === 0) {
  30. $last = (int)substr($last, strlen($this->getPrefix()));
  31. } else {
  32. $last = (int)$last;
  33. }
  34. $next = $last + 1;
  35. return $this->format($next);
  36. }
  37. }