<commit_before><?php

namespace Heystack\Ecommerce\Currency;

use Heystack\Ecommerce\Currency\Traits\HasCurrencyServiceTrait;
use Heystack\Ecommerce\Locale\Traits\HasLocaleServiceTrait;
use SebastianBergmann\Money\IntlFormatter;
use SebastianBergmann\Money\Money;

/**
 * Class Money
 * @package Heystack\Ecommerce\Currency
 */
class MoneyCasting extends \ViewableData
{
    use HasLocaleServiceTrait;
    
    private static $casting = [
        'Nice' => 'Text'
    ];

    /**
     * @var \SebastianBergmann\Money\Money
     */
    protected $value;

    /**
     * @param \SebastianBergmann\Money\Money $value
     */
    public function setValue(Money $value)
    {
        $this->value = $value;
    }

    /**
     * @return \SebastianBergmann\Money\Money
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * @return string
     */
    public function Nice()
    {
        return $this->getFormatter()->format($this->value);
    }

    /**
     * @return string
     */
    public function forTemplate()
    {
        return $this->Nice();
    }

    /**
     * @return \SebastianBergmann\Money\IntlFormatter
     */
    protected function getFormatter()
    {
        return new IntlFormatter(
            sprintf(
                'en-%s',
                $this->localeService->getActiveCountry()->getCountryCode()
            )
        );
    }

    /**
     * The value "exists" if it is not 0
     * @return bool
     */
    public function exists()
    {
        return $this->value->getAmount() !== 0;
    }
}<commit_msg>Remove country codes that sometimes appear in front of currency symbols<commit_after><?php

namespace Heystack\Ecommerce\Currency;

use Heystack\Ecommerce\Currency\Traits\HasCurrencyServiceTrait;
use Heystack\Ecommerce\Locale\Traits\HasLocaleServiceTrait;
use SebastianBergmann\Money\IntlFormatter;
use SebastianBergmann\Money\Money;

/**
 * Class Money
 * @package Heystack\Ecommerce\Currency
 */
class MoneyCasting extends \ViewableData
{
    use HasLocaleServiceTrait;
    
    private static $casting = [
        'Nice' => 'Text'
    ];

    /**
     * @var \SebastianBergmann\Money\Money
     */
    protected $value;

    /**
     * @param \SebastianBergmann\Money\Money $value
     */
    public function setValue(Money $value)
    {
        $this->value = $value;
    }

    /**
     * @return \SebastianBergmann\Money\Money
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * Remove country codes that sometimes appear in front of currency symbols
     * @return string
     */
    public function Nice()
    {
        return preg_replace('/[A-Za-z]/', '', $this->getFormatter()->format($this->value));
    }

    /**
     * @return string
     */
    public function forTemplate()
    {
        return $this->Nice();
    }

    /**
     * @return \SebastianBergmann\Money\IntlFormatter
     */
    protected function getFormatter()
    {
        return new IntlFormatter(
            sprintf(
                'en-%s',
                $this->localeService->getActiveCountry()->getCountryCode()
            )
        );
    }

    /**
     * The value "exists" if it is not 0
     * @return bool
     */
    public function exists()
    {
        return $this->value->getAmount() !== 0;
    }
}
{'fraction_non_alphanumeric': 0.12609088173337346, 'fraction_numerical': 0.0012037315678603672, 'mean_word_length': 2.094972067039106, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4414342', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1006, 'n_words': 196}