TrimmedValue.php 757 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Model\Config\Backend;
  6. use Magento\Framework\App\Config\Value;
  7. /**
  8. * Trim config value
  9. *
  10. * @package Temando\Shipping\Model
  11. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  12. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  13. * @link http://www.temando.com/
  14. */
  15. class TrimmedValue extends Value
  16. {
  17. /**
  18. * Trim value before save
  19. *
  20. * @return \Magento\Framework\Model\AbstractModel
  21. */
  22. public function beforeSave()
  23. {
  24. $value = $this->getValue();
  25. $this->setValue(trim($value));
  26. return parent::beforeSave();
  27. }
  28. }