| Current Path : /home/rtorresani/www/app/code/Amasty/ImportCore/Import/DataHandling/FieldModifier/ |
| Current File : //home/rtorresani/www/app/code/Amasty/ImportCore/Import/DataHandling/FieldModifier/Str2Float.php |
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Import Core for Magento 2 (System)
*/
namespace Amasty\ImportCore\Import\DataHandling\FieldModifier;
use Amasty\ImportCore\Api\Modifier\FieldModifierInterface;
use Amasty\ImportCore\Import\DataHandling\AbstractModifier;
use Amasty\ImportCore\Import\DataHandling\ModifierProvider;
class Str2Float extends AbstractModifier implements FieldModifierInterface
{
/**
* @param string $value
* @return float|mixed
*/
public function transform($value)
{
return is_numeric($value)
? floatval($value)
: $value;
}
public function getGroup(): string
{
return ModifierProvider::TEXT_GROUP;
}
public function getLabel(): string
{
return __('Trim')->getText();
}
}