*
@param value
@return String the transaction cancellation source corresponding to the informed source value
510605
public function getTypeFromValue($value = null)
    {
        $value = ($value == null ? $this->value : $value);
        return array_search($this->value, self::$sourceList);
    }
293228
public function sanitize($value)
    {
        $value = (string) $value;

        if (!empty($value)) {
            $value = JComponentHelper::filterText($value);
        }

        return $value;
    }
124558
protected function dontCast($value, string $explain = null)
    {
        if ($this->failure) {
            $valueType = $this->getValueTypeDescription($value);

            $type = $this->getType();
            $cast = isset($this->name) ? "cast {$this->name} from" : "cast";

            $message = "Unable to {$cast} {$valueType} to $type" . (isset($explain) ? ": $explain" : '');

            if (is_int($this->failure)) {
                trigger_error($message, $this->failure);
            } else {
                $class = $this->failure;
                throw new $class($message);
            }
        }
        
        return $value;
    }
900870
public function parseValue($value)
    {
        if (strlen($value) === 0) {
            return $value;
        }

        if ($value[0] === '"' || $value[0] === "'") {
            $value = substr($value, 1, -1);
        }

        $value = stripslashes($value);

        return $value;
    }
729490
private static function normalizeValue($value)
    {
        if (is_string($value)) {
            $value = str_ireplace(['&nbsp;', '&#160;'], ' ', $value);
            $value = trim($value);

            return ($value === '') ? null : $value;
        }

        return $value;
    }
43304
public static function getMessageForError($value)
    {
        if (self::isValidName($value)) {
            $value = self::getNameValue($value);
        }

        return isset(self::$messages[$value]) ? self::$messages[$value] : null;
    }
497688
static function assic($value)
    {
        $len = strlen($value);
        for ($i = 0; $i < $len; $i++)
        {
            $ord = ord(substr($value, $i, 1));
            if ($ord > 127) return false;
        }
        return $value;
    }
428549
public function beforeSaveValue($value)
    {
        try
        {
            $value      = Json::encode($value);
        } catch (\Exception $e)
        {
            $value      = "{}";
        }

        return $value;
    }
397223
public static function getAccountSideSignFromLanguage($value) {
        switch (strtolower($value)) {
            case strtolower(StaticEb::$accountsideDebitSign):
            case strtolower(StaticEb::formatAccountside('D')):
                return 'D';
            case strtolower(StaticEb::$accountsideCreditSign):
            case strtolower(StaticEb::formatAccountside('C')):
                return 'C';
            default:
                throw new Exception(\Yii::t('common/staticeb', 'Cannot determine accoundside sign from  value "{value}". Valid values: '
                        . StaticEb::$accountsideDebitSign . ', ' . StaticEb::formatAccountside('D') . ', '
                        . StaticEb::$accountsideCreditSign . ', ' . StaticEb::formatAccountside('C'), [ 'value' => $value]
                ));
        }
    }
1012106
public static function resolve($value)
    {
        switch (strtolower($value)) {
            case self::NEWEST:
                return self::NEWEST;
            case self::AUTHORIZED:
                return self::AUTHORIZED;
            case self::NOT_AUTHORIZED:
                return self::NOT_AUTHORIZED;
            case self::PAID:
                return self::PAID;
            case 'canceled':
            case self::CANCELLED:
                return self::CANCELLED;
            case self::WAITING:
                return self::WAITING;
        }

        return null;
    }
750129
public static String getResultSetCloseString(int value) {
        switch (value) {
            case Statement.CLOSE_ALL_RESULTS:
                return "CLOSE ALL RESULTS (" + value + ')'; 

            case Statement.CLOSE_CURRENT_RESULT:
                return "CLOSE CURRENT RESULT (" + value + ')'; 

            case Statement.KEEP_CURRENT_RESULT:
                return "KEEP CURRENT RESULT (" + value + ')'; 
        }

        return "UNKNOWN CLOSE RESULTSET CONSTANT (" + value + ')'; 
    }
918810
public function reverseTransform($value): ?MoneyValue
    {
        if (null === $value || '' === $value) {
            return null;
        }

        if (!\is_string($value)) {
            throw new TransformationFailedException('Expected a string or null.');
        }

        if ('NaN' === $value) {
            throw new TransformationFailedException('"NaN" is not a valid number');
        }

        if (false !== mb_strpos($value, '∞')) {
            throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like.');
        }

        // Convert normal spaces to fixed spaces.
        $value = str_replace(' ', "\xc2\xa0", $value);

        $formatter = $this->getNumberFormatter();

        $groupSep = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
        $decSep = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
        $withCurrency = (bool) preg_match('#\p{Sc}#u', $value);

        // Some locales use the space as group separation.
        // The ICU data confirms this, but since v58.1 this can no longer be parsed
        // in the currency format. Unless you use DECIMAL which doesn't work
        // for currency. So... simple remove the spaces between numbers.
        $value = preg_replace("/(\\p{N})\xc2\xa0(\\p{N})/u", '$1$2', $value);

        if ('.' !== $decSep && (!$this->grouping || '.' !== $groupSep)) {
            $value = str_replace('.', $decSep, $value);
        }

        if (',' !== $decSep && (!$this->grouping || ',' !== $groupSep)) {
            $value = str_replace(',', $decSep, $value);
        }

        if (!$withCurrency) {
            $value = $this->addCurrencySymbol($value);
        }

        try {
            $money = (new IntlMoneyParser($formatter, new ISOCurrencies()))->parse($value);

            return new MoneyValue($money, $withCurrency);
        } catch (ParserException $e) {
            throw new TransformationFailedException($e->getMessage(), 0, $e);
        } catch (\Exception $e) {
            throw new TransformationFailedException($e->getMessage(), 0, $e);
        }
    }
503506
protected function interpretAsDate($value)
    {
        if (null === $value || 0 === $value || '' === $value) {
            return null;
        }

        if ($value instanceof DateTime) {
            return $value;
        }

        if (is_string($value)) {
            return new Carbon($value);
        }

        if (is_numeric($value)) {
            return Carbon::createFromTimestamp($value);
        }

        throw new UnexpectedValueException("Expecting null or date");
    }
322874
private function processValue($value)
    {
        if ($value === "NOW()") {
            return $this->connection()->quote(gmdate("Y-m-d H:i:s"));
        } elseif ($value === "NULL") {
            return 'NULL';
        } elseif (is_array($value)) {
            return $this->connection()->quote(json_encode($value));
        } else {
            return $this->connection()->quote($value);
        }
    }
638847
public function transform($value): ?string
    {
        if (null === $value) {
            return '';
        }

        if (!$value instanceof MoneyValue) {
            throw new TransformationFailedException('Expected a MoneyValue object.');
        }

        $result = (new IntlMoneyFormatter($this->getNumberFormatter(), new ISOCurrencies()))->format($value->value);

        // Convert fixed spaces to normal ones
        $result = str_replace(["\xc2\xa0", "\xe2\x80\xaf"], ' ', $result);

        if (!$value->withCurrency) {
            $result = $this->removeCurrencySymbol($result, (string) $value->value->getCurrency());
        }

        return $result;
    }
1035685
private function getNativeValueFromDefinition($value)
    {
        if ($this->strStartsWith($value, "'") && $this->strEndsWith($value, "'")) {
            $value = trim(trim($value, "'")); // single quote
        } else {
            if ($this->strStartsWith($value, '"') && $this->strEndsWith($value, '"')) {
                $value = trim(trim($value, '"')); // double quote
            } else {
                if ($value == 'true') {
                    $value = true;
                } else {
                    if ($value == 'false') {
                        $value = false;
                    } else {
                        if (is_numeric($value)) {
                            if (ctype_digit($value)) {
                                return (integer)$value;
                            } else {
                                return (float)$value;
                            }
                        }
                    }
                }
            }
        }

        return $value;
    }
953688
protected function databaseValue($value)
    {
        if (!$value instanceof \DateTime) {
            throw ODMException::conversionFailedInvalidType($value, Type::TIME, ['null', 'DateTime']);
        }

        $this->setToUnixEpoch($value);

        return (string)$value->getTimestamp();
    }